#
Programming for Mathematics

## Course timings from 18th August: 11:30-12:30; Mondays, Wednesdays and Fridays (media room, IMSc)

Live Stream for the course

This will not work unless course is streaming live at this time. The next session is scheduled for 10:30am on Friday.

Sage server (accessible only from within IMSc).

### Jump to:

- Introduction to Sage (4 Aug)
- Introductory Programming Tutorial (6 Aug)
- Advanced Prgramming Tutorial (8 Aug)
- Sharing and Interacting in Sage (11 Aug)

- Toward the Code (13 Aug)

- Classes in python-1 (18 Aug)

- Classes in python-2 (20 Aug)

- Classes in python-3 (22 Aug)

- Inheritance (24 Aug)

- Inheritance 2 (26 Aug)

- Exceptions and Iterators (1 Sept)

- List Methods and Functions (3 Sept)

- Iterators for Partitions and Lattice Paths (5 Sept)

## Lecture 1: Introduction to Sage

Monday, 4th August 2014, 10:30am - 11:30am.

Notes for Lecture 1

### Homework

Please come to the next class with code, not just answers. The point is to
learn how to do this consistently; many you could do "by hand", after all.
- Find three topics in the combinatorics directory you didn't know about,
but should. Be ready to show someone else how to compute it.
- Find a tutorial in the Sage documentation written by Anne Schilling,
one of the presenters at Sage Days 60.
- What was your favorite function in calculus? Can you calculate its integral?
- Solve one of the harder Sudoku puzzles linked http://dingo.sbs.arizona.edu/~sandiway/sudoku/examples.html, using Sage.
- How many graphs are there of order five? (Up to isomorphism.)
- How many graphs are there of order five and size six?
- Do Project Euler's problem seven.
- Compute the sum of the primes below n, where n=30,100,1000, and two million. For the last few, you may want to learn about a "list" from a good Python tutorial, such as this one, this one, or another one from this list.
- Use Sage to calculate the determinant of the diagonal matrix of ranks
one through ten with all ones on the diagonal. (You know the answer, but get Sage to do it for you!)
- Look up the list of programs which Sage uses internally or has interfaces to. Have you used any of them?

### Video Recording

The video for lecture 1 will be up soon on our YouTube channel, and will be linked from this page.
## Lecture 2: Introductory Programming Tutorial

Wednesday, 6th August 2014, 10:30am-11:30am.

Notes for Lecture 2 and homework

## Lecture 3: Advanced Programming Tutorial

Friday, 8th August 2014, 10:30am-11:30am.

Notes for Lecture 3 and homework

## Lecture 4: Sharing and Interacting In Sage

Monday, 11th August 2014, 10:30am-11:30am.

Notes for Lecture 4 and homework

## Lecture 5: Toward the Code

Wednesday, 13th August 2014, 10:30am-11:30am.

Notes for Lecture 5 and homework

## Lecture 6: Classes in python

Monday, 18 August 2014, 11:30am-12:30pm.

Lecture notes

Home work

## Lecture 7: Classes in python

Wednesday, 20 August 2014, 11:30am-12:30pm.

Lecture Notes

Homework

staticvar.py

Aug)

## Lecture 8: Persistent variables in classes, mutable and immutable objects

Lecture notes

Homework

## Lecture 9: Inheritance

Notes

Sample file with class inheritance

homework

## Lecture 10: Inheritance 2

Notes

multipoint.py

Homework

## Lecture 11: Exceptions and Iterators

Code from the class

Homework
## Lecture 12: List Methods and Functions

Code from the class

## Lecture 13: Iterators for partitions and Lattice Paths

Code for the class

Homework: Create (in pure python) and iterator for permutations.