Why Python? - University of Arizona

101
Why Python? Joseph Thomas University of Arizona Department of Mathematics November 5, 2012

Transcript of Why Python? - University of Arizona

Why Python?

Joseph Thomas

University of ArizonaDepartment of Mathematics

November 5, 2012

What is Python?

Python

I ... is an interpreted programming language.

I ... was invented around 1991.

I ... is intended to emphasize code readability.I ... takes ideas from several programming paradigms

I procedural languages (like C)I object oriented languages (like Java)I functional languages (like Lisp, Haskell)

I ... is used by many industries (Google, etc.).

What is Python?

Python

I ... is an interpreted programming language.

I ... was invented around 1991.

I ... is intended to emphasize code readability.I ... takes ideas from several programming paradigms

I procedural languages (like C)I object oriented languages (like Java)I functional languages (like Lisp, Haskell)

I ... is used by many industries (Google, etc.).

What is Python?

Python

I ... is an interpreted programming language.

I ... was invented around 1991.

I ... is intended to emphasize code readability.I ... takes ideas from several programming paradigms

I procedural languages (like C)I object oriented languages (like Java)I functional languages (like Lisp, Haskell)

I ... is used by many industries (Google, etc.).

What is Python?

Python

I ... is an interpreted programming language.

I ... was invented around 1991.

I ... is intended to emphasize code readability.

I ... takes ideas from several programming paradigms

I procedural languages (like C)I object oriented languages (like Java)I functional languages (like Lisp, Haskell)

I ... is used by many industries (Google, etc.).

What is Python?

Python

I ... is an interpreted programming language.

I ... was invented around 1991.

I ... is intended to emphasize code readability.I ... takes ideas from several programming paradigms

I procedural languages (like C)I object oriented languages (like Java)I functional languages (like Lisp, Haskell)

I ... is used by many industries (Google, etc.).

What is Python?

Python

I ... is an interpreted programming language.

I ... was invented around 1991.

I ... is intended to emphasize code readability.I ... takes ideas from several programming paradigms

I procedural languages (like C)I object oriented languages (like Java)I functional languages (like Lisp, Haskell)

I ... is used by many industries (Google, etc.).

What is Python?

Python

I ... is an interpreted programming language.

I ... was invented around 1991.

I ... is intended to emphasize code readability.I ... takes ideas from several programming paradigms

I procedural languages (like C)

I object oriented languages (like Java)I functional languages (like Lisp, Haskell)

I ... is used by many industries (Google, etc.).

What is Python?

Python

I ... is an interpreted programming language.

I ... was invented around 1991.

I ... is intended to emphasize code readability.I ... takes ideas from several programming paradigms

I procedural languages (like C)I object oriented languages (like Java)

I functional languages (like Lisp, Haskell)

I ... is used by many industries (Google, etc.).

What is Python?

Python

I ... is an interpreted programming language.

I ... was invented around 1991.

I ... is intended to emphasize code readability.I ... takes ideas from several programming paradigms

I procedural languages (like C)I object oriented languages (like Java)I functional languages (like Lisp, Haskell)

I ... is used by many industries (Google, etc.).

What is Python?

Python

I ... is an interpreted programming language.

I ... was invented around 1991.

I ... is intended to emphasize code readability.I ... takes ideas from several programming paradigms

I procedural languages (like C)I object oriented languages (like Java)I functional languages (like Lisp, Haskell)

I ... is used by many industries (Google, etc.).

Why Python?

For the mathematical researcher, a software tool should:

I Let you implement an idea fast.

I Avoid reinventing the wheel.

I Allow you to naturally convert math into code.I Example: Is a (mathematical) function

I A procedure call?I An array?I A hash map / dictionary / associative array?I A set of tuples?

Why Python?

For the mathematical researcher, a software tool should:

I Let you implement an idea fast.

I Avoid reinventing the wheel.

I Allow you to naturally convert math into code.I Example: Is a (mathematical) function

I A procedure call?I An array?I A hash map / dictionary / associative array?I A set of tuples?

Why Python?

For the mathematical researcher, a software tool should:

I Let you implement an idea fast.

I Avoid reinventing the wheel.

I Allow you to naturally convert math into code.I Example: Is a (mathematical) function

I A procedure call?I An array?I A hash map / dictionary / associative array?I A set of tuples?

Why Python?

For the mathematical researcher, a software tool should:

I Let you implement an idea fast.

I Avoid reinventing the wheel.

I Allow you to naturally convert math into code.

I Example: Is a (mathematical) function

I A procedure call?I An array?I A hash map / dictionary / associative array?I A set of tuples?

Why Python?

For the mathematical researcher, a software tool should:

I Let you implement an idea fast.

I Avoid reinventing the wheel.

I Allow you to naturally convert math into code.I Example: Is a (mathematical) function

I A procedure call?I An array?I A hash map / dictionary / associative array?I A set of tuples?

Why Python?

For the mathematical researcher, a software tool should:

I Let you implement an idea fast.

I Avoid reinventing the wheel.

I Allow you to naturally convert math into code.I Example: Is a (mathematical) function

I A procedure call?I An array?I A hash map / dictionary / associative array?I A set of tuples?

Why Python?

For the mathematical researcher, a software tool should:

I Let you implement an idea fast.

I Avoid reinventing the wheel.

I Allow you to naturally convert math into code.I Example: Is a (mathematical) function

I A procedure call?

I An array?I A hash map / dictionary / associative array?I A set of tuples?

Why Python?

For the mathematical researcher, a software tool should:

I Let you implement an idea fast.

I Avoid reinventing the wheel.

I Allow you to naturally convert math into code.I Example: Is a (mathematical) function

I A procedure call?I An array?

I A hash map / dictionary / associative array?I A set of tuples?

Why Python?

For the mathematical researcher, a software tool should:

I Let you implement an idea fast.

I Avoid reinventing the wheel.

I Allow you to naturally convert math into code.I Example: Is a (mathematical) function

I A procedure call?I An array?I A hash map / dictionary / associative array?

I A set of tuples?

Why Python?

For the mathematical researcher, a software tool should:

I Let you implement an idea fast.

I Avoid reinventing the wheel.

I Allow you to naturally convert math into code.I Example: Is a (mathematical) function

I A procedure call?I An array?I A hash map / dictionary / associative array?I A set of tuples?

Why Python?

Python is a useful language to know if you want to...

I quickly (and correctly) implement an abstract idea.

I bring together many different libraries (which might not be inPython) to do something new.

I easily link your code into a computer algebra system (namelySage).

I process data (particularly text) and/or crawl the internet.

Why Python?

Python is a useful language to know if you want to...

I quickly (and correctly) implement an abstract idea.

I bring together many different libraries (which might not be inPython) to do something new.

I easily link your code into a computer algebra system (namelySage).

I process data (particularly text) and/or crawl the internet.

Why Python?

Python is a useful language to know if you want to...

I quickly (and correctly) implement an abstract idea.

I bring together many different libraries (which might not be inPython) to do something new.

I easily link your code into a computer algebra system (namelySage).

I process data (particularly text) and/or crawl the internet.

Why Python?

Python is a useful language to know if you want to...

I quickly (and correctly) implement an abstract idea.

I bring together many different libraries (which might not be inPython) to do something new.

I easily link your code into a computer algebra system (namelySage).

I process data (particularly text) and/or crawl the internet.

Why Python?

Python is a useful language to know if you want to...

I quickly (and correctly) implement an abstract idea.

I bring together many different libraries (which might not be inPython) to do something new.

I easily link your code into a computer algebra system (namelySage).

I process data (particularly text) and/or crawl the internet.

Example: Bayesian Spam Filtering

I Q: Can we detect a statistical difference between the emailswritten by spammers and regular people?

I Fundamental Problem: Given a word w , estimate theprobability w comes from a spam email.

I Context: Use Bayes’ Theorem to estimate the probability anemail is spam, based upon its words.

I I made a lot of assumptions. Do I still have a usefulapproximation?

Example: Bayesian Spam Filtering

I Q: Can we detect a statistical difference between the emailswritten by spammers and regular people?

I Fundamental Problem: Given a word w , estimate theprobability w comes from a spam email.

I Context: Use Bayes’ Theorem to estimate the probability anemail is spam, based upon its words.

I I made a lot of assumptions. Do I still have a usefulapproximation?

Example: Bayesian Spam Filtering

I Q: Can we detect a statistical difference between the emailswritten by spammers and regular people?

I Fundamental Problem: Given a word w , estimate theprobability w comes from a spam email.

I Context: Use Bayes’ Theorem to estimate the probability anemail is spam, based upon its words.

I I made a lot of assumptions. Do I still have a usefulapproximation?

Example: Bayesian Spam Filtering

I Q: Can we detect a statistical difference between the emailswritten by spammers and regular people?

I Fundamental Problem: Given a word w , estimate theprobability w comes from a spam email.

I Context: Use Bayes’ Theorem to estimate the probability anemail is spam, based upon its words.

I I made a lot of assumptions. Do I still have a usefulapproximation?

Example: Bayesian Spam Filtering

I Q: Can we detect a statistical difference between the emailswritten by spammers and regular people?

I Fundamental Problem: Given a word w , estimate theprobability w comes from a spam email.

I Context: Use Bayes’ Theorem to estimate the probability anemail is spam, based upon its words.

I I made a lot of assumptions. Do I still have a usefulapproximation?

Example: Bayesian Spam Filtering

We need to do an experiment!

I Get a collection of emails, classified into spam and not-spam.

I Estimate P(w appears in a spam email) by

# appearances of word w in the corpus

# words in the corpus

Programming Problem:

I Input: A bunch of emails (text).

I Output: A dictionary mapping words to the conditionalprobability that they appear in an email from the spam corpus.

I Sub-Problems:

I Reading a file (get a big string).I Break the text of the file into pieces.I Building a dictionary data structure.

Example: Bayesian Spam Filtering

We need to do an experiment!

I Get a collection of emails, classified into spam and not-spam.

I Estimate P(w appears in a spam email) by

# appearances of word w in the corpus

# words in the corpus

Programming Problem:

I Input: A bunch of emails (text).

I Output: A dictionary mapping words to the conditionalprobability that they appear in an email from the spam corpus.

I Sub-Problems:

I Reading a file (get a big string).I Break the text of the file into pieces.I Building a dictionary data structure.

Example: Bayesian Spam Filtering

We need to do an experiment!

I Get a collection of emails, classified into spam and not-spam.

I Estimate P(w appears in a spam email) by

# appearances of word w in the corpus

# words in the corpus

Programming Problem:

I Input: A bunch of emails (text).

I Output: A dictionary mapping words to the conditionalprobability that they appear in an email from the spam corpus.

I Sub-Problems:

I Reading a file (get a big string).I Break the text of the file into pieces.I Building a dictionary data structure.

Example: Bayesian Spam Filtering

We need to do an experiment!

I Get a collection of emails, classified into spam and not-spam.

I Estimate P(w appears in a spam email) by

# appearances of word w in the corpus

# words in the corpus

Programming Problem:

I Input: A bunch of emails (text).

I Output: A dictionary mapping words to the conditionalprobability that they appear in an email from the spam corpus.

I Sub-Problems:

I Reading a file (get a big string).I Break the text of the file into pieces.I Building a dictionary data structure.

Example: Bayesian Spam Filtering

We need to do an experiment!

I Get a collection of emails, classified into spam and not-spam.

I Estimate P(w appears in a spam email) by

# appearances of word w in the corpus

# words in the corpus

Programming Problem:

I Input: A bunch of emails (text).

I Output: A dictionary mapping words to the conditionalprobability that they appear in an email from the spam corpus.

I Sub-Problems:

I Reading a file (get a big string).I Break the text of the file into pieces.I Building a dictionary data structure.

Example: Bayesian Spam Filtering

We need to do an experiment!

I Get a collection of emails, classified into spam and not-spam.

I Estimate P(w appears in a spam email) by

# appearances of word w in the corpus

# words in the corpus

Programming Problem:

I Input: A bunch of emails (text).

I Output: A dictionary mapping words to the conditionalprobability that they appear in an email from the spam corpus.

I Sub-Problems:

I Reading a file (get a big string).I Break the text of the file into pieces.I Building a dictionary data structure.

Example: Bayesian Spam Filtering

We need to do an experiment!

I Get a collection of emails, classified into spam and not-spam.

I Estimate P(w appears in a spam email) by

# appearances of word w in the corpus

# words in the corpus

Programming Problem:

I Input: A bunch of emails (text).

I Output: A dictionary mapping words to the conditionalprobability that they appear in an email from the spam corpus.

I Sub-Problems:

I Reading a file (get a big string).I Break the text of the file into pieces.I Building a dictionary data structure.

Example: Bayesian Spam Filtering

We need to do an experiment!

I Get a collection of emails, classified into spam and not-spam.

I Estimate P(w appears in a spam email) by

# appearances of word w in the corpus

# words in the corpus

Programming Problem:

I Input: A bunch of emails (text).

I Output: A dictionary mapping words to the conditionalprobability that they appear in an email from the spam corpus.

I Sub-Problems:

I Reading a file (get a big string).I Break the text of the file into pieces.I Building a dictionary data structure.

Example: Bayesian Spam Filtering

We need to do an experiment!

I Get a collection of emails, classified into spam and not-spam.

I Estimate P(w appears in a spam email) by

# appearances of word w in the corpus

# words in the corpus

Programming Problem:

I Input: A bunch of emails (text).

I Output: A dictionary mapping words to the conditionalprobability that they appear in an email from the spam corpus.

I Sub-Problems:I Reading a file (get a big string).

I Break the text of the file into pieces.I Building a dictionary data structure.

Example: Bayesian Spam Filtering

We need to do an experiment!

I Get a collection of emails, classified into spam and not-spam.

I Estimate P(w appears in a spam email) by

# appearances of word w in the corpus

# words in the corpus

Programming Problem:

I Input: A bunch of emails (text).

I Output: A dictionary mapping words to the conditionalprobability that they appear in an email from the spam corpus.

I Sub-Problems:I Reading a file (get a big string).I Break the text of the file into pieces.

I Building a dictionary data structure.

Example: Bayesian Spam Filtering

We need to do an experiment!

I Get a collection of emails, classified into spam and not-spam.

I Estimate P(w appears in a spam email) by

# appearances of word w in the corpus

# words in the corpus

Programming Problem:

I Input: A bunch of emails (text).

I Output: A dictionary mapping words to the conditionalprobability that they appear in an email from the spam corpus.

I Sub-Problems:I Reading a file (get a big string).I Break the text of the file into pieces.I Building a dictionary data structure.

Python Code

Input: A file F of emails.Output: A mapping of words to conditional probabilities.

W = open("emails.txt").read (). split()

D = {}

for w in W:

if w not in D:

D[w] = 1

else:

D[w] = D[w] + 1

for w in D:

D[w] = D[w]/len(W)

Example: Bayesian Spam Filtering — Java versus Python

Python Solution: 93 lines of code.Java Solution: 321 lines of code.Why the difference?

I Different languages have different goals!

I Python: Get a small prototype working quickly.

I Java: Build huge applications from organized code.

I Matlab/Mathematica/GAP: Make working with math easy(without necessarily providing a lot of CS primitives).

Moral: If you want to know “Is my theory correct?”, maybecode-correctness and ease of implementation matter more thanspeed and maintainability.

Example: Bayesian Spam Filtering — Java versus Python

Python Solution: 93 lines of code.Java Solution: 321 lines of code.Why the difference?

I Different languages have different goals!

I Python: Get a small prototype working quickly.

I Java: Build huge applications from organized code.

I Matlab/Mathematica/GAP: Make working with math easy(without necessarily providing a lot of CS primitives).

Moral: If you want to know “Is my theory correct?”, maybecode-correctness and ease of implementation matter more thanspeed and maintainability.

Example: Bayesian Spam Filtering — Java versus Python

Python Solution: 93 lines of code.Java Solution: 321 lines of code.Why the difference?

I Different languages have different goals!

I Python: Get a small prototype working quickly.

I Java: Build huge applications from organized code.

I Matlab/Mathematica/GAP: Make working with math easy(without necessarily providing a lot of CS primitives).

Moral: If you want to know “Is my theory correct?”, maybecode-correctness and ease of implementation matter more thanspeed and maintainability.

Example: Bayesian Spam Filtering — Java versus Python

Python Solution: 93 lines of code.Java Solution: 321 lines of code.Why the difference?

I Different languages have different goals!

I Python: Get a small prototype working quickly.

I Java: Build huge applications from organized code.

I Matlab/Mathematica/GAP: Make working with math easy(without necessarily providing a lot of CS primitives).

Moral: If you want to know “Is my theory correct?”, maybecode-correctness and ease of implementation matter more thanspeed and maintainability.

Example: Bayesian Spam Filtering — Java versus Python

Python Solution: 93 lines of code.Java Solution: 321 lines of code.Why the difference?

I Different languages have different goals!

I Python: Get a small prototype working quickly.

I Java: Build huge applications from organized code.

I Matlab/Mathematica/GAP: Make working with math easy(without necessarily providing a lot of CS primitives).

Moral: If you want to know “Is my theory correct?”, maybecode-correctness and ease of implementation matter more thanspeed and maintainability.

Example: Bayesian Spam Filtering — Java versus Python

Python Solution: 93 lines of code.Java Solution: 321 lines of code.Why the difference?

I Different languages have different goals!

I Python: Get a small prototype working quickly.

I Java: Build huge applications from organized code.

I Matlab/Mathematica/GAP: Make working with math easy(without necessarily providing a lot of CS primitives).

Moral: If you want to know “Is my theory correct?”, maybecode-correctness and ease of implementation matter more thanspeed and maintainability.

Example: Bayesian Spam Filtering — Java versus Python

Python Solution: 93 lines of code.Java Solution: 321 lines of code.Why the difference?

I Different languages have different goals!

I Python: Get a small prototype working quickly.

I Java: Build huge applications from organized code.

I Matlab/Mathematica/GAP: Make working with math easy(without necessarily providing a lot of CS primitives).

Moral: If you want to know “Is my theory correct?”, maybecode-correctness and ease of implementation matter more thanspeed and maintainability.

Python, Sage, and Visualization

Sage, a computer algebra system from the University ofWashington, is written in Python.

I The project takes advantage of a lot of good softwareengineering ideas, particularly when it comes todocumentation.

I Unlike Mathematica, GAP, and Matlab, there is basically nodistinction between Python code and Sage code.

I Theme: Prototype in SAGE, then move polished code outinto python files.

I Let’s see an example!

Python, Sage, and Visualization

Sage, a computer algebra system from the University ofWashington, is written in Python.

I The project takes advantage of a lot of good softwareengineering ideas, particularly when it comes todocumentation.

I Unlike Mathematica, GAP, and Matlab, there is basically nodistinction between Python code and Sage code.

I Theme: Prototype in SAGE, then move polished code outinto python files.

I Let’s see an example!

Python, Sage, and Visualization

Sage, a computer algebra system from the University ofWashington, is written in Python.

I The project takes advantage of a lot of good softwareengineering ideas, particularly when it comes todocumentation.

I Unlike Mathematica, GAP, and Matlab, there is basically nodistinction between Python code and Sage code.

I Theme: Prototype in SAGE, then move polished code outinto python files.

I Let’s see an example!

Python, Sage, and Visualization

Sage, a computer algebra system from the University ofWashington, is written in Python.

I The project takes advantage of a lot of good softwareengineering ideas, particularly when it comes todocumentation.

I Unlike Mathematica, GAP, and Matlab, there is basically nodistinction between Python code and Sage code.

I Theme: Prototype in SAGE, then move polished code outinto python files.

I Let’s see an example!

Python, Sage, and Visualization

Sage, a computer algebra system from the University ofWashington, is written in Python.

I The project takes advantage of a lot of good softwareengineering ideas, particularly when it comes todocumentation.

I Unlike Mathematica, GAP, and Matlab, there is basically nodistinction between Python code and Sage code.

I Theme: Prototype in SAGE, then move polished code outinto python files.

I Let’s see an example!

Python, Sage, and Visualization

Common Geometry Problem: Visualizing examples in R3.Example: Consider a hyper-rectangular prism.

Up to scaling, a hyper-rectangular prism is specified by 3 positivelengths (x , y , z).

Research Problem: Investigate geodesics on this space, based on(x , y , z).

Python, Sage, and Visualization

Common Geometry Problem: Visualizing examples in R3.Example: Consider a hyper-rectangular prism.

Up to scaling, a hyper-rectangular prism is specified by 3 positivelengths (x , y , z).

Research Problem: Investigate geodesics on this space, based on(x , y , z).

Hyper-rectangular PrismCalculation Problem:

I Easy: How does a geodesic move through one cell?

I Hard: Tracking how all eight cells are connected.

I Given a sequence of cells, is there a geodesic through them?

I I want to visualize this with a tumbling!

A “tumbling” of the hyper-rectangularprism.

Hyper-rectangular PrismCalculation Problem:

I Easy: How does a geodesic move through one cell?

I Hard: Tracking how all eight cells are connected.

I Given a sequence of cells, is there a geodesic through them?

I I want to visualize this with a tumbling!

A “tumbling” of the hyper-rectangularprism.

Hyper-rectangular PrismCalculation Problem:

I Easy: How does a geodesic move through one cell?

I Hard: Tracking how all eight cells are connected.

I Given a sequence of cells, is there a geodesic through them?

I I want to visualize this with a tumbling!

A “tumbling” of the hyper-rectangularprism.

Hyper-rectangular PrismCalculation Problem:

I Easy: How does a geodesic move through one cell?

I Hard: Tracking how all eight cells are connected.

I Given a sequence of cells, is there a geodesic through them?

I I want to visualize this with a tumbling!

A “tumbling” of the hyper-rectangularprism.

Hyper-rectangular PrismCalculation Problem:

I Easy: How does a geodesic move through one cell?

I Hard: Tracking how all eight cells are connected.

I Given a sequence of cells, is there a geodesic through them?

I I want to visualize this with a tumbling!

A “tumbling” of the hyper-rectangularprism.

Drawing Tumblings

A tumbling is just a sequence of adjacent rectangular prisms in R3.We’ll use JMol to visualize it.I want to show different things in different situations:

I The labels we put on the vertices/edges.

I Only certain labels on the vertices.

I Particular colors of the cells.

How can I get all of this in one procedure call?

def drawCube( eCube ,

showEdgesTuple =(False ,False ,False),

showVertexLabelPred =( lambda vert: True),

colorCube=False ):

Drawing Tumblings

A tumbling is just a sequence of adjacent rectangular prisms in R3.We’ll use JMol to visualize it.I want to show different things in different situations:

I The labels we put on the vertices/edges.

I Only certain labels on the vertices.

I Particular colors of the cells.

How can I get all of this in one procedure call?

def drawCube( eCube ,

showEdgesTuple =(False ,False ,False),

showVertexLabelPred =( lambda vert: True),

colorCube=False ):

Drawing Tumblings

A tumbling is just a sequence of adjacent rectangular prisms in R3.We’ll use JMol to visualize it.I want to show different things in different situations:

I The labels we put on the vertices/edges.

I Only certain labels on the vertices.

I Particular colors of the cells.

How can I get all of this in one procedure call?

def drawCube( eCube ,

showEdgesTuple =(False ,False ,False),

showVertexLabelPred =( lambda vert: True),

colorCube=False ):

Drawing Tumblings

A tumbling is just a sequence of adjacent rectangular prisms in R3.We’ll use JMol to visualize it.I want to show different things in different situations:

I The labels we put on the vertices/edges.

I Only certain labels on the vertices.

I Particular colors of the cells.

How can I get all of this in one procedure call?

def drawCube( eCube ,

showEdgesTuple =(False ,False ,False),

showVertexLabelPred =( lambda vert: True),

colorCube=False ):

Drawing Tumblings

A tumbling is just a sequence of adjacent rectangular prisms in R3.We’ll use JMol to visualize it.I want to show different things in different situations:

I The labels we put on the vertices/edges.

I Only certain labels on the vertices.

I Particular colors of the cells.

How can I get all of this in one procedure call?

def drawCube( eCube ,

showEdgesTuple =(False ,False ,False),

showVertexLabelPred =( lambda vert: True),

colorCube=False ):

Drawing Tumblings

A tumbling is just a sequence of adjacent rectangular prisms in R3.We’ll use JMol to visualize it.I want to show different things in different situations:

I The labels we put on the vertices/edges.

I Only certain labels on the vertices.

I Particular colors of the cells.

How can I get all of this in one procedure call?

def drawCube( eCube ,

showEdgesTuple =(False ,False ,False),

showVertexLabelPred =( lambda vert: True),

colorCube=False ):

Using Libraries

What if I need to do [Computationally Intensive Process P] ?

Anecdote:

I I once studied a bio-informatics problem in which I needed tosolve a big, messy linear program at run-time.

I Linear programming packages are usually written in C.

I Bad Assumption: If I need a C library, my whole programmust be in C.

I Price of this assumption: ∼ 3000 lines of hard-to-modify Ccode. (Replaced by ∼ 600 lines of easy Python code.)

Moral: Sometimes it’s better to specify your problem in adescriptive language, then hand it over to a C library for solving.

Using Libraries

What if I need to do [Computationally Intensive Process P] ?Anecdote:

I I once studied a bio-informatics problem in which I needed tosolve a big, messy linear program at run-time.

I Linear programming packages are usually written in C.

I Bad Assumption: If I need a C library, my whole programmust be in C.

I Price of this assumption: ∼ 3000 lines of hard-to-modify Ccode. (Replaced by ∼ 600 lines of easy Python code.)

Moral: Sometimes it’s better to specify your problem in adescriptive language, then hand it over to a C library for solving.

Using Libraries

What if I need to do [Computationally Intensive Process P] ?Anecdote:

I I once studied a bio-informatics problem in which I needed tosolve a big, messy linear program at run-time.

I Linear programming packages are usually written in C.

I Bad Assumption: If I need a C library, my whole programmust be in C.

I Price of this assumption: ∼ 3000 lines of hard-to-modify Ccode. (Replaced by ∼ 600 lines of easy Python code.)

Moral: Sometimes it’s better to specify your problem in adescriptive language, then hand it over to a C library for solving.

Using Libraries

What if I need to do [Computationally Intensive Process P] ?Anecdote:

I I once studied a bio-informatics problem in which I needed tosolve a big, messy linear program at run-time.

I Linear programming packages are usually written in C.

I Bad Assumption: If I need a C library, my whole programmust be in C.

I Price of this assumption: ∼ 3000 lines of hard-to-modify Ccode. (Replaced by ∼ 600 lines of easy Python code.)

Moral: Sometimes it’s better to specify your problem in adescriptive language, then hand it over to a C library for solving.

Using Libraries

What if I need to do [Computationally Intensive Process P] ?Anecdote:

I I once studied a bio-informatics problem in which I needed tosolve a big, messy linear program at run-time.

I Linear programming packages are usually written in C.

I Bad Assumption: If I need a C library, my whole programmust be in C.

I Price of this assumption: ∼ 3000 lines of hard-to-modify Ccode. (Replaced by ∼ 600 lines of easy Python code.)

Moral: Sometimes it’s better to specify your problem in adescriptive language, then hand it over to a C library for solving.

Using Libraries

What if I need to do [Computationally Intensive Process P] ?Anecdote:

I I once studied a bio-informatics problem in which I needed tosolve a big, messy linear program at run-time.

I Linear programming packages are usually written in C.

I Bad Assumption: If I need a C library, my whole programmust be in C.

I Price of this assumption: ∼ 3000 lines of hard-to-modify Ccode. (Replaced by ∼ 600 lines of easy Python code.)

Moral: Sometimes it’s better to specify your problem in adescriptive language, then hand it over to a C library for solving.

Libraries

I Numpy : Linear algebra, big arrays, Fourier analysis, etc.

I cvxopt/PyGLPK : Linear programming solvers.I Cython : Connect your C/C++ code to Python.

I Call C/C++ from PythonI Call Python from C/C++I Pass data between languages (without writing/parsing text

files).

Libraries

I Numpy : Linear algebra, big arrays, Fourier analysis, etc.

I cvxopt/PyGLPK : Linear programming solvers.I Cython : Connect your C/C++ code to Python.

I Call C/C++ from PythonI Call Python from C/C++I Pass data between languages (without writing/parsing text

files).

Libraries

I Numpy : Linear algebra, big arrays, Fourier analysis, etc.

I cvxopt/PyGLPK : Linear programming solvers.

I Cython : Connect your C/C++ code to Python.

I Call C/C++ from PythonI Call Python from C/C++I Pass data between languages (without writing/parsing text

files).

Libraries

I Numpy : Linear algebra, big arrays, Fourier analysis, etc.

I cvxopt/PyGLPK : Linear programming solvers.I Cython : Connect your C/C++ code to Python.

I Call C/C++ from PythonI Call Python from C/C++I Pass data between languages (without writing/parsing text

files).

Libraries

I Numpy : Linear algebra, big arrays, Fourier analysis, etc.

I cvxopt/PyGLPK : Linear programming solvers.I Cython : Connect your C/C++ code to Python.

I Call C/C++ from PythonI Call Python from C/C++I Pass data between languages (without writing/parsing text

files).

Libraries

I Numpy : Linear algebra, big arrays, Fourier analysis, etc.

I cvxopt/PyGLPK : Linear programming solvers.I Cython : Connect your C/C++ code to Python.

I Call C/C++ from Python

I Call Python from C/C++I Pass data between languages (without writing/parsing text

files).

Libraries

I Numpy : Linear algebra, big arrays, Fourier analysis, etc.

I cvxopt/PyGLPK : Linear programming solvers.I Cython : Connect your C/C++ code to Python.

I Call C/C++ from PythonI Call Python from C/C++

I Pass data between languages (without writing/parsing textfiles).

Libraries

I Numpy : Linear algebra, big arrays, Fourier analysis, etc.

I cvxopt/PyGLPK : Linear programming solvers.I Cython : Connect your C/C++ code to Python.

I Call C/C++ from PythonI Call Python from C/C++I Pass data between languages (without writing/parsing text

files).

Example: Gluing Code

The Mathematics Genealogy Project catalogs people who receivedPhD’s in math and data on their advisor(s).

All of this data is posted to the web.

Question: What would the “genealogical tree” of the departmentlook like?

Problems:

I We can find out, for ≥ $150 + (Shipping and Handling).

I The MGP website doesn’t offer all the data in a convenienttext file.

I We could do all the work by hand (a lot of labor).

Python Solution: ∼ 300 lines of code.

Example: Gluing Code

The Mathematics Genealogy Project catalogs people who receivedPhD’s in math and data on their advisor(s).All of this data is posted to the web.

Question: What would the “genealogical tree” of the departmentlook like?

Problems:

I We can find out, for ≥ $150 + (Shipping and Handling).

I The MGP website doesn’t offer all the data in a convenienttext file.

I We could do all the work by hand (a lot of labor).

Python Solution: ∼ 300 lines of code.

Example: Gluing Code

The Mathematics Genealogy Project catalogs people who receivedPhD’s in math and data on their advisor(s).All of this data is posted to the web.

Question: What would the “genealogical tree” of the departmentlook like?

Problems:

I We can find out, for ≥ $150 + (Shipping and Handling).

I The MGP website doesn’t offer all the data in a convenienttext file.

I We could do all the work by hand (a lot of labor).

Python Solution: ∼ 300 lines of code.

Example: Gluing Code

The Mathematics Genealogy Project catalogs people who receivedPhD’s in math and data on their advisor(s).All of this data is posted to the web.

Question: What would the “genealogical tree” of the departmentlook like?

Problems:

I We can find out, for ≥ $150 + (Shipping and Handling).

I The MGP website doesn’t offer all the data in a convenienttext file.

I We could do all the work by hand (a lot of labor).

Python Solution: ∼ 300 lines of code.

Example: Gluing Code

The Mathematics Genealogy Project catalogs people who receivedPhD’s in math and data on their advisor(s).All of this data is posted to the web.

Question: What would the “genealogical tree” of the departmentlook like?

Problems:

I We can find out, for ≥ $150 + (Shipping and Handling).

I The MGP website doesn’t offer all the data in a convenienttext file.

I We could do all the work by hand (a lot of labor).

Python Solution: ∼ 300 lines of code.

Example: Gluing Code

The Mathematics Genealogy Project catalogs people who receivedPhD’s in math and data on their advisor(s).All of this data is posted to the web.

Question: What would the “genealogical tree” of the departmentlook like?

Problems:

I We can find out, for ≥ $150 + (Shipping and Handling).

I The MGP website doesn’t offer all the data in a convenienttext file.

I We could do all the work by hand (a lot of labor).

Python Solution: ∼ 300 lines of code.

Example: Gluing Code

The Mathematics Genealogy Project catalogs people who receivedPhD’s in math and data on their advisor(s).All of this data is posted to the web.

Question: What would the “genealogical tree” of the departmentlook like?

Problems:

I We can find out, for ≥ $150 + (Shipping and Handling).

I The MGP website doesn’t offer all the data in a convenienttext file.

I We could do all the work by hand (a lot of labor).

Python Solution: ∼ 300 lines of code.

Example: Gluing Code

The Mathematics Genealogy Project catalogs people who receivedPhD’s in math and data on their advisor(s).All of this data is posted to the web.

Question: What would the “genealogical tree” of the departmentlook like?

Problems:

I We can find out, for ≥ $150 + (Shipping and Handling).

I The MGP website doesn’t offer all the data in a convenienttext file.

I We could do all the work by hand (a lot of labor).

Python Solution: ∼ 300 lines of code.

Example: Gluing Code

The Mathematics Genealogy Project catalogs people who receivedPhD’s in math and data on their advisor(s).All of this data is posted to the web.

Question: What would the “genealogical tree” of the departmentlook like?

Problems:

I We can find out, for ≥ $150 + (Shipping and Handling).

I The MGP website doesn’t offer all the data in a convenienttext file.

I We could do all the work by hand (a lot of labor).

Python Solution: ∼ 300 lines of code.

Jim CushingUniversity of Maryland

College Park 1968

Monroe MartinThe Johns Hopkins

University 1932

Georg LichtenbergGeorg-August-

UniversitätGöttingen

1765

Heinrich BrandesGeorg-August-

UniversitätGöttingen

1800

Heinrich ScherkUniversität Berlin

1823

Abraham KästnerUniversität Leipzig

1739

Ernst KummerMartin-Luther-

Universität Halle-Wittenberg

1831

Friedrich BesselGeorg-August-

UniversitätGöttingen

1810

Christoph GudermannHumboldt-Universität

zu Berlin 1832

Karl WeierstraßUniversitätKönigsberg

1854

Victor GuilleminHarvard University

1962

Leonid FriedlanderMassachusetts Institute

of Technology 1989

Shlomo SternbergThe Johns Hopkins

University 1957

Johannes MüllerRheinische Friedrich-Wilhelms-Universität

Bonn 1822

Hermann von HelmholtzUniversität Berlin

1842

Philipp von WaltherLudwig-Maximilians-Universität Landshut

1803

Karl RudolphiErnst-Moritz-Arndt-

UniversitätGreifswald

1795

Hermann SchwarzUniversität Berlin

1864

Friedrich SchottkyUniversität Berlin

1875

Christian von WeigelGeorg-August-

UniversitätGöttingen

1771

Leon LichtensteinUniversität Berlin

1909

Aurel WintnerUniversität Leipzig

1928

Carl GaußUniversitätHelmstedt

1799

Georg BeerUniversität Wien

1786

Johan FrankRuprecht-Karls-

UniversitätHeidelberg

1766

Wrap Up

In Summary:

I Mathematical research on the computer is not softwareengineering.

I Python makes many good ideas from software engineeringaccessible for mathematical research.

I It allows you to develop a correct prototype quickly ...

I ... then improve your code’s speed/usability when you knowyou’ve found a good idea.

I It allows you to connect disparate tools and libraries...

I ...and integrate them into a computer algebra system, Sage.

Thanks!

Wrap Up

In Summary:

I Mathematical research on the computer is not softwareengineering.

I Python makes many good ideas from software engineeringaccessible for mathematical research.

I It allows you to develop a correct prototype quickly ...

I ... then improve your code’s speed/usability when you knowyou’ve found a good idea.

I It allows you to connect disparate tools and libraries...

I ...and integrate them into a computer algebra system, Sage.

Thanks!

Wrap Up

In Summary:

I Mathematical research on the computer is not softwareengineering.

I Python makes many good ideas from software engineeringaccessible for mathematical research.

I It allows you to develop a correct prototype quickly ...

I ... then improve your code’s speed/usability when you knowyou’ve found a good idea.

I It allows you to connect disparate tools and libraries...

I ...and integrate them into a computer algebra system, Sage.

Thanks!

Wrap Up

In Summary:

I Mathematical research on the computer is not softwareengineering.

I Python makes many good ideas from software engineeringaccessible for mathematical research.

I It allows you to develop a correct prototype quickly ...

I ... then improve your code’s speed/usability when you knowyou’ve found a good idea.

I It allows you to connect disparate tools and libraries...

I ...and integrate them into a computer algebra system, Sage.

Thanks!

Wrap Up

In Summary:

I Mathematical research on the computer is not softwareengineering.

I Python makes many good ideas from software engineeringaccessible for mathematical research.

I It allows you to develop a correct prototype quickly ...

I ... then improve your code’s speed/usability when you knowyou’ve found a good idea.

I It allows you to connect disparate tools and libraries...

I ...and integrate them into a computer algebra system, Sage.

Thanks!

Wrap Up

In Summary:

I Mathematical research on the computer is not softwareengineering.

I Python makes many good ideas from software engineeringaccessible for mathematical research.

I It allows you to develop a correct prototype quickly ...

I ... then improve your code’s speed/usability when you knowyou’ve found a good idea.

I It allows you to connect disparate tools and libraries...

I ...and integrate them into a computer algebra system, Sage.

Thanks!

Wrap Up

In Summary:

I Mathematical research on the computer is not softwareengineering.

I Python makes many good ideas from software engineeringaccessible for mathematical research.

I It allows you to develop a correct prototype quickly ...

I ... then improve your code’s speed/usability when you knowyou’ve found a good idea.

I It allows you to connect disparate tools and libraries...

I ...and integrate them into a computer algebra system, Sage.

Thanks!

Wrap Up

In Summary:

I Mathematical research on the computer is not softwareengineering.

I Python makes many good ideas from software engineeringaccessible for mathematical research.

I It allows you to develop a correct prototype quickly ...

I ... then improve your code’s speed/usability when you knowyou’ve found a good idea.

I It allows you to connect disparate tools and libraries...

I ...and integrate them into a computer algebra system, Sage.

Thanks!

Wrap Up

In Summary:

I Mathematical research on the computer is not softwareengineering.

I Python makes many good ideas from software engineeringaccessible for mathematical research.

I It allows you to develop a correct prototype quickly ...

I ... then improve your code’s speed/usability when you knowyou’ve found a good idea.

I It allows you to connect disparate tools and libraries...

I ...and integrate them into a computer algebra system, Sage.

Thanks!