advertisement

Quantitative Reasoning with Python Ramchandar Krishnamurthy March 20, 2015 Course Title Quantitative Reasoning with Python Programme Title Undergraduate Programme - Foundations Mode M1 Level L1 Course ID QRE103 Credits 3 Course Type Core Semester I Course Development Team Ramchandar Krishnamurthy, Shantha Bhushan, Rajaram Nityananda, Richard Fernandes, Kripa Gowrishankar, Proteep Mallik Course Instructor(s) Ramchandar Krishnamurthy 1 Rationale This is the course design document for a course that fulfills the Quantitative Reasoning (QR) requirement of the Undergraduate Programme (UG) offered by the School of Liberal Studies in Azim Premji University. Quantitative Reasoning is a 3-credit requirement that is part of the Foundations in the Common Curriculum of the Undergraduate Programme. Using mathematics as a form of understanding to interpret the world around us is a core aspect of liberal education. The UG programme acknowledges this importance and has made QR a mandatory component of the Common Curriculum. This course does not view mathematics education as a set of concepts and skills to be acquired by students. Instead, students are expected to develop a broad disposition towards a mathematical way of thinking and reasoning. Towards this end, students would engage with two broad areas of mathematics – Graph Theory1 and Computational Statistics. In these 2 areas, the course would adopt a non-algebraic approach to problem solving. Students would learn programming techniques, using Python, and develop computational models to engage with these mathematical problems. 1.1 Why Computer Programming in a QR course? • To develop algorithmic thinking. It is asserted that algorithmic thinking is one way of quantitative reasoning. • An argument can be made that use of computational models to solve mathematical problems would place less demands on students who find algebraic approaches difficult. Computational models are more amenable to iterative, trial-and-error and simulation approaches to solving problems. • Computer programming as a skill would be valuable for various pursuits of students both within the programme and later. 1 http://en.wikipedia.org/wiki/Graph_theory 2 1.2 Why Python? If the computational approach is accepted, we have three main choices for the compuR tational tool – MATLAB , R and Python. R is proprietary (each time we have to include the registered trademark • MATLAB symbol in our documents!) and users have to pay for licenses. While it does provide a high level programming language, it is oriented towards science and engineering. Given that the QR students can have social science or humanities backgrounds a general purpose language like Python would be more appropriate. • R is a free software environment for statistical computing and graphics. Again, R is built with the specific purpose for data analysis while Python is a more general purpose programming language. If we would like students to develop algorithmic thinking Python would be more amenable. • Python is Open-source2 and free (both food and speech (gratis and libre)). Python has packages like NumPy and SciPy that provide functionality for scientific proR gramming similar to MATLAB and packages like pandas (python data analysis library) that provide high performance data structures and data analysis tools similar to R. 2 Objectives The core set of aims of this course is to develop in students the capacity to: • Observe patterns in phenomena • Abstract these patterns into mathematical objects • Develop mathematical models using these mathematical objects • Analyze/Predict phenomena by using relevant mathematical operations on these objects • Communicate effectively the analyses and predictions • Develop and demonstrate algorithmic thinking 2.1 Guiding Principles This course has been designed keeping two guiding principles in mind: • Less is more: The course would emphasize on depth in few concepts rather than attempting a broad coverage of concepts • Many coats of paint: The concepts would be repeatedly encountered through different contexts, experiments and computations 2 http://en.wikipedia.org/wiki/Open-source_software 3 3 Unit 1 - Graph Theory This is is the first Unit of the course and we start by presenting some interesting routing problems and how the idea of graphs allows for solutions to these problems. We choose this model since it is very different from what students generally perceive as a mathematical model. Solutions to graph based problems are also algorithmic in nature and that allows an easy transition into computer programming. 3.1 Duration 8 weeks (This includes introduction to Python programming (Unit 2). The course would start from the idea of Graphs and the kind of problems that can be solved through graphs. Python would then be introduced as a way to implement some algorithms in Graph Theory). 3.2 Objectives 1. Solve simple Graph problems 2. Express graphs as computer representations (adjacency matrix and incidence matrix) 3. Develop computer programs to implement some of the Graph Theoretical algorithms (for e.g. finding the Eulerian path for a graph) 4. Recognize/identify and analyze real life problems (work patterns of postmen, couriers, delivery persons) that could be modeled as Graphs 3.3 Content 1. Routing Problems – Courier or Postmen’s routes 2. Introduction to Graphs (Components) – Edges, Vertices, Paths, Circuits, Bridges, Simple/Connected/Disconnected Graphs, Cliques 3. Konigsberg Bridges Puzzle and Euler’s Theorem 4. Fleury’s Algorithm for finding an Euler Circuit (Path) 5. The Traveling Salesman’s Problem (TSP) 6. Hamilton Circuits and Paths 7. TSP - Brute Force Algorithm 4 8. TSP - Nearest Neighbor Algorithm 9. TSP - Cheapest Link Algorithm 3.4 Pedagogy The basic knowledge of graphs would be introduced through classroom lectures. Students would be given problem sets with varying difficulty levels. Problem sets would include both pen-paper solutions and programming solutions. A ‘field’ project of interviewing and following a postman/courier/delivery boy to understand how to engage with the routing problem and critique their approach considering the formal graph theoretical approach. 3.5 Assessment Every week would culminate with a quiz that is not graded. These non-graded assessments would help students to check their understanding and also act as a diagnostic for the instructor to respond appropriately in tutorials and planning for the subsequent weeks of instruction. At the end of the unit the following assessments would be made – a graded quiz (10%), a computer program submission (10%) and a group project presentation (10%). This Unit would have 30% weight of the course. 3.6 Resources 1. Chapters 5,6,7 and 8 of Excursions in Modern Mathematics [1] 2. Chapter 14 of Thinking Mathematically [2] 3. http://www.bogotobogo.com/python/python_graph_data_structures.php 4. MIT Open Courseware on Graph Theory and Coloring – http://tinyurl.com/ ks98amr 4 Unit 2 - Introduction to Programming in Python The students are introduced to computer programming as a way of implementing graph algorithms. The basic control and data structures of computer programs are introduced. 4.1 Duration 8 weeks along with Unit 1 4.2 Objectives 1. Identify the basic syntactic structures of Python – Variables, Expressions, Statements, Control Structures, Functions 2. Develop simple programs 3. Understand the use of basic data structures – Lists, Dictionaries,Tuples 5 4.3 Content 1. The way of the program 2. Variables, expressions and statements 3. Functions 4. Conditionals and recursion 5. Iteration 6. Lists, Dictionaries and Tuples 4.4 Pedagogy This unit would be entirely in lab mode. We would write programs during the class together and there would be short programming assignments (non-graded) after every class. These programs would be reviewed during tutorials. Students would review each others programs and learn to read programs and not just write them. Once the basic competence to write simple computer programs are acquired, the students would attempt to write programs to implement the graph algorithms. 4.5 Assessment After the 2nd week a short quiz would be used check the current understanding of the students. This would not be graded. At the end of the unit a more detailed quiz that checks the basic understanding of programming concepts and also includes short programming problems. This quiz would carry 20% weightage of the course. 4.6 Resources 1. Book: Think Python – How to Think Like a Computer Scientist [3] 2. Web-site: http://www.learnpython.org/ 5 Unit 3 - Computational Probability and Statistics This Unit is almost entirely inspired by the book Think Stats: Probability and Statistics for Programmers[6]. The unit takes a computational approach to understand the use of statistics with large data sets. The advantages of such an approach are quoted here verbatim from ThinkStats: • Students write programs to test their understanding of statistical concepts like least squares fit or coefficients of determination. This active engagement with the concept would help them seek clarity and depth. • Some ideas that are hard to grasp mathematically are easy to understand by simulation. For example, we approximate p-values by running Monte-Carlo simulations, which reinforces the meaning of the p-value 6 While the data sets used during the course are mainly American data sets, we would start using Indian data sets – both external (like National Sample Survey data) and internal (like Literacy Research in Indian Languages data) – as and when time permits. If this approach is successful in its first iteration, we plan to replace entirely the ThinkStats data sets with Indian data sets from the second iteration onwards. 5.1 Duration 8 weeks 5.2 Objectives At the end of this unit, students would be able to: 1. Organize and manipulate data sets using computational techniques. 2. Generate descriptive statistics and visualize data and communicate meaningfully these summaries and visualizations. 3. Look for patterns in the data that might give clues for answers to questions that they are interested in. 4. Evaluate whether the effect is real or if it happened just by chance (hypothesis testing), where they see apparent effects, like a difference between two groups 5. Estimate characteristics of the population by using data of a sample 6. Understand what are reliable and usable data sources in India. 5.3 Content The 9 chapters of the ThinkStats book would be used as content. These include – an introduction to statistical thinking, descriptive statistics, distribution functions and continuous distributions, probability, central limit theorem, hypothesis testing, estimation and correlation. 5.4 Pedagogy All classes would be divided into lecture sessions, lab sessions and tutorials. The introduction to the topics would be done through lectures which would be quickly followed by lab sessions. The book is organized in a ’project mode’ of learning which requires a lot of work on the computer. The tutorial sessions would be utilized to engage with the problem sets presented in the book. Since this is an introductory unit, we will not expect students to engage with a large data set as a project. Those students who are advanced either in programming or statistics would be encouraged to work independently with Indian data sets. 5.5 Assessment The assessment for this Unit would be through a quiz (10%) and a programming assignment (20%). An end of semester interview is planned for each student with 20% weight. The student would have the choice of talking about a problem of interest to them and the mathematical approach they would use to analyze/solve the problem. 7 5.6 Resources 1. Think Stats by Allen Downey [6] 2. Chapters 14,15,16 and 17 of Tannenbaum [1] 3. Activity Based Statistics by Scheaffer et al [7] References [1] Excursions in Modern Mathematics (8e), Peter Tannenbaum, Pearson, 2014 [2] Thinking Mathematically, Robert Blitzer, Pearson, 2015 [3] Think Python – How to Think Like a Computer Scientist, Allen B. Downey, http: //www.greenteapress.com/thinkpython/ [4] Math in Society – A survey of mathematics for the liberal arts major. By David Lippman. http://www.opentextbookstore.com/mathinsociety/ [5] http://coloring-4kids.com/mowgli-and-kaa-coloring-pages-for-kids-printable-free/ [6] Think Stats: Probability and Statistics for Programmers, version 1.6.0. Allen B. Downey, Green Tea Press, Needham, Massachusetts http://greenteapress.com/ thinkstats/ [7] Activity Based Statistics, 2nd Edition, Richard L. Schaeffer, Ann Watkins, Jeffrey Witmer, Mrudulla Gnanadesikan, T. Erickson, Key College (June 3, 2004) 8