CompSciSpring2018

Introduction to Scientific Computing

Course Info
 * Course Numbers CHM 4932-004/6938-010, CRN: 20438/20439
 * Credit Hours: 3
 * Meeting Dates: January 8 - April 25, 2018
 * No Class Jan. 15 or Mar. 12-18
 * Meeting Times: Mon. and Wed., 12:30-13:45 in SCA 222
 * Midterm Project Presentations: Mon.-Wed., Mar 5 and 7.
 * Final Project Presentations: Wed., May 2, 10:00am – 12:00pm (scheduled final date)
 * Lab Session & Office Hours: Fri. 12:30-13:45 in IDR 214 (or SCA 222 by announcement)

$ for((i=1;i<=4;i++)); do cal $i 2018; done ____ January 2018 ____     _____ March 2018 ____ | Su Mo Tu We Th Fr Sa |   | Su Mo Tu We Th Fr Sa   |     1  2  3  4  5  6 |    |              1 (2) 3 1 | 7  8  9*10 11 12 13 |  9 |  4 (5) 6 (7) 8  9 10 2 | 14  x 16*17 18 19 20 |    |     x     x          3 | 21*22 23 24 25 26 27 | 10 | 18*19 20 21 22 23 24 4 | 28*29 30 31         | 11 | 25*26 27 28 29 30 31

___ February 2018 ____     _____ April 2018 ____ | Su Mo Tu We Th Fr Sa |   | Su Mo Tu We Th Fr Sa   |              1  2  3 | 12 |  1 *2  3  4  5  6  7 5 | 4 *5  6  7  8  9 10 | 13 |  8 *9 10 11 12 13 14 6 | 11*12 13 14 15 16 17 | 14 | 15*16 17 18 19 20 21 7 | 18*19 20 21 22 23 24 | 15 | 22*23 24(25)26 27 28 8 | 25*26 27 28          |    | 29  x

Week Topic 1   Calculator Form 2   Pseudocode 3   Plotting 1 (Excel) 4   Plotting 2 (Matplotlib and linear spaces) 5   Abstraction 1 (advanced functions and oo method) 6   Abstraction 2 (Booleans and logic) 7   2D transforms and iterated maps 8   Optimization 1 (Newton-Rhapson) 9    midterm project presentations 10   Optimization 2 (MD Energy) 11   ODE and SDE algorithms 12   Statistics 13   Complexity 14   Circe and Linux crash course 15   Compile & install process, ctypes

Overview
Mathematical models in the natural sciences take many shapes and forms. The moment they become more complicated than tracking a few variables over time, we have to put away our Excel spreadsheets and make use of a solid foundation in computational science. The course establishes this foundation by introducing data structures and algorithms used in everyday scientific computing using examples in the python scripting language. By the end of the Semester, students will be able to navigate the Linux command-line to go from a mathematical model to a numerical solution. Best practices for working with computer code and visualizing data will also be covered.

Topics

 * 1) Languages
 * 2) * bash (shell)
 * 3) * python (scripting)
 * 4) * stack & register-based machine languages: overview of C and Fortran syntax & compiling with gcc, ‘thread safety’
 * 5) * Shared libraries & language inter-operability (FFI)
 * 6) Algorithms
 * 7) * Horner’s algorithm for polynomials
 * 8) * Newton’s root finding algo.
 * 9) * Overview of general optimization algo-s (example: linear & nonlin. least-squares)
 * 10) * Numerical integration (scripted, plus gnu ODE)
 * 11) * Communication (how HTTP get/put works)
 * 12) Data Structures
 * 13) * Linked Lists
 * 14) * Trees (file system hierarchies)
 * 15) * Graphs
 * 16) * Arrays (dense & sparse) example: vectors & rotations / transpositions, densities and difference operators
 * 17) Presentation & visualization
 * 18) * Flat CSV files (and excel)
 * 19) * Working with binary data
 * 20) * Python matplotlib (2D images)
 * 21) * Binning histograms & weighted averages
 * 22) Best Practices
 * 23) * High-level code design (modularity, interface specifications, unit testing, etc.)
 * 24) * Code audit: open-source libraries, ex. Gnu Scientific Library, qsort in libc, Boost
 * 25) * Source code versioning (example: git or mercurial)
 * 26) * gdb & execution profiling
 * 27) * documentation
 * 28) * Makefiles

Grading
Grading Scale (out of 400 points possible)


 * (280 U / 330 G) Points Possible:
 * 9 homework assignments (10 points per homework)
 * 14 in-class assignments / quizzes (10 points per week)
 * 2 projects / competitions (50 points per project)
 * Undergraduates must complete 1 project, graduates must complete 2


 * Important Rules
 * For maximum benefit, homework should be done on-time. However, homework will be allowed to be re-submitted at any time for full credit, but must present a unique solution to previous work from yourself or others.
 * All work must cite co-group members (if any) and the source of any code snippets used online.

Grading Rationale
Homework points will only be awarded for correct, working code and correct algorithmic analysis, while the homework problems will become progressively tougher. Undergraduates should be able to pass the course with an A if they have correctly answered most of the homework, appear at class prepared and on-time, and made a strong attempt at one of the projects. Graduate students should both perform well on the homework and successfully complete one or two projects. The re-grading for homework allows making up for missed assignments, and encourages returning to core concepts at a later point in the class. Students who have put in the studying effort, completed significant portions of the homework and projects both in- and out of class have thus demonstrated introductory programming proficiency.

Projects

 * Midterm Project Description [[Media:Midterm2018.pdf]] (2 Mar., 2018)
 * Agile Development Tips & Tricks
 * Midterm Projects:


 * Final Project Description (25 Apr., 2018)

Textbooks and Resources

 * Beginning Python, Hetland, 2005 (eBook avail. from USF Library)
 * Python Algorithms, Hetland, 2010 (eBook avail. from USF Library)
 * The Architecture of Open Source Applications
 * Python Documentation
 * Google Introductory Python Notes
 * Tao of Programming

Other (possibly useful) materials:
 * The Jargon File
 * Chapters 7&8 of Modelling and Simulation, Birta and Arbez, Springer 2007 (eBook avail. from USF Library).
 * Chapters 4-6 of Models and Algorithms for Intelligent Data Analysis, Runkler, Springer 2012 (eBook avail. from USF Library).
 * Guide to Scientific Computing in C++, Francis and Whiteley, Springer, 2012. (eBook avail. from USF Library)
 * Extra info. On the basics:
 * Chapters 3 and 7 of Mathematics in Computing, Regan, Springer 2013. (eBook avail. from USF Library)
 * Instant feedback graphical programming with Khan Academy
 * Local PyBulls Meetings

Code:
 * Python Libraries Useful for Geospatial Problems
 * Python Libraries Useful for Computational Chemistry (very small list at present)

Interactive Interpreters:
 * CodeWars Recommended for building experience with practice problems.
 * CodeCombat A very visual way to interact with your python code.
 * Exercism A command-line client with a similar learn-through-challenge philosophy.
 * repl.it A read-eval-print loop for several computer languages.
 * CppReference Documentation with an online evaluator for C++ code.

In-Class Problems

 * Week 1: [[Media:CalculatorProbs.pdf|Calculator Problems]]
 * Solutions:
 * This solution uses python list comprehensions, and shows that the slowest step is actually unit conversion!
 * Week 2: [[Media:Pseudocode.pdf|Pseudocode Problems]]
 * We will work these in class. For practice, be sure you have python list ideas down!
 * Solutions:
 * Week 3: [[Media:Plotting1.pdf|Plotting 1]]
 * Notes on installing Matplotlib on your own computer
 * Challenge: actions vs. functions -- what does the following code do: "[ print(1) for i in range(10) ]" (python3 only)
 * Week 4: [[Media:Plotting2.pdf|Plotting 2]]
 * Solutions:
 * Week 5: Read pseudocode and plotting, focusing on types and syntax. Also, re-read the end of chapter summaries for Ch. 3, 5 and 6.
 * Week 6: Read the following pieces on first order logic Chapter 1 of Jaynes' Book Hamming's Problem, and pages 71-80 in Chapter 4 of Hetland's Algorithms book (on induction). Just skip directly to chapter 4.
 * Solutions
 * Week 7: Review Hetland, Chapters 3-7. We'll do a series of parsing problems and flex our collective induction and recursion muscles.
 * Week 7 Problems
 * Week 8: [[Media:Minimization1.pdf|Minimization Problems!]]
 * Week 10: [[Media:Minimization2.pdf|Molecular Optimization]]
 * Week 11: [[Media:Dynamics.pdf|Dynamical Problems]]
 * Week 12: [[Media:InvPend.pdf|Inverse Pendulum]]

Homework

 * Homework will be assigned through Repl.IT
 * Project presentations will be on Mon.-Wed., Mar 5-7
 * Final Project presentations will be during exam time, Wed., May 2