# Re: [pyatl] Discrete Math and Python

 From: Sean Sent on: Saturday, September 12, 2009 3:49 AM
```For really basic stuff, sage is overkill. But since it's really just
Python with a ton of math libraries and such, you can do the simple
stuff and more advanced stuff as you need it. For instance, if you
wanted to cover graph theory at some point, you wouldn't have to tell
your students to go and install NetworkX. It's already there. I don't
know if you've used NetworkX before, but it's pretty awesome. Here's a
simple example to display a petersen graph, find the graph's chromatic
number and check if it's connected:

from sage.graphs import graph_generators
g = graphs.PetersenGraph­()
print g.is_connected()
print g.chromatic_number()­
g.show()

and it'll print out its chromatic number (3) and checks if it is
connected (it is) and displays the graph: http://imgur.com/...­

Making your own graphs is really easy as well. I won't go into that
though. I feel like I've said enough :-)

On Sat, Sep 12, 2009 at 2:14 AM, Skylar Saveland
> I'm creating a course in discrete math and python and would be glad to have
> input and code reviews.
>
> Some of my first programs would be like:
>
> ? 1) Given an iterable and a positive integer, return the unique
> permutations (unique lists) and unique combinations (sets).
> ? 2) Given a string, return the set of all unique permutations (as strings)
>
> Maybe even showing a few ways to do it in Python and why one way is more
> efficient and/or pythonic.
>
> I'm looking at these as outlines:
>
> http://www.sm.lut...­
>
> http://www.math.j...­
>
>
> A great project is http://www.sagema...­.
>
> I might get back into that code (they have a ton of great math built on
> python) but I kind of want to naively think things through from a basic
> level so it will make a good course.
>
> Cheers,
> Skylar Saveland
>
>
>
>
> --
> this mailing list ([address removed])
> This message was sent by Skylar Saveland ([address removed]) from
> PyAtl: Atlanta Python Programmers.
>
> 632 Broadway, New York, NY 10012 USA
```

### Atlanta, GA

Founded Dec 19, 2002

#### People in this Meetup are also in:

• ##### Atlanta Ruby Meetup Group

2,169 Ruby programmers

• ##### Atlanta Startup Village

8,144 Entrepreneurs

1,383 Makers

• ##### The Atlanta JavaScript Meetup Group

3,715 Javascript Developers

• ##### AAII Atlanta Investment Chapter

2,145 Savvy Investors

583 Members