# Topics in Mathematics: Scientific Computing

## Course Materials

Syllabus
Background Material (A list of topics I hope you have seen before)

## Lecture Notes

1. Numerical Methods for Unconstrained Optimization
2. Solvers for Nonlinear Systems
3. ODE solvers I
4. ODE solvers II
5. ODE solvers III
6. Computational Methods for Dynamical Systems
7. The Three Body Problem
8. Brief Comments on Finite Precision Arithmetic (Related to a code debugging exercise we did in class)
9. Random Number Generation
10. Probability I
11. Probability II
12. Sampling From Nonuniform Distributions I
13. Sampling From Nonuniform Distributions II
14. The Monte Carlo Method
15. Linear Dispersive Waves
16. The Nonlinear Schroedinger Equation I
17. The Nonlinear Schroedinger Equation II
18. The Split-Step Fourier Method for Numerical Solution of NLSE I
19. The Split-Step Fourier Method for Numerical Solution of NLSE II
20. NLSE with Noise
21. Introduction to the Finite Element Method
22. The Finite Element Method: Linear Lagrange Elements
23. Introduction to FEniCS
24. Introduction to Python (Demo Codes)
25A. Implementation of 1D Finite Element Method Using Python Classes [pdf]
25B. Implementation of 1D Finite Element Method Using Python Classes [python code]
25. Finite-Element Modeling of Trace Gas Sensors I
26. Finite-Element Modeling of Trace Gas Sensors II

## Projects

General Advice for Scientific Computing Projects

MATLAB Introduction (not for credit)
Mini-project 0: Implementation of Newton's method for unconstrained optimization (Due Wed Sept 11)
Project 1: Three ODE problems (Due Wed Oct 2)
Project 2: The restricted planar three-body problem (Due Fri Oct 25)
Project 3: Sampling from Non-Uniform Distributions (Due Wed Nov 13)
Project 4: Monte Carlo Simulations for the Nonlinear Schroedingier Equation with Noise (Due Mon Dec 2)
Project 5: Finite-Element Modeling of a Trace Gas Sensor (Due Thurs Dec 19 at 10am [NO EXCEPTIONS])

## MATLAB Code for Demonstration in Class

Matlab demo codes and results generated using publish.
Tar-gzip distribution of the Matlab demos codes.

## MATLAB Tutorials

Here are two good MATLAB tutorials. The first teaches basic MATLAB porgramming skills, while the second is a more advanced.

Mathworks Matlab Tutorial
Interactive Matlab Course from Eindhoven Technical University

## Installing FEniCS

FEniCS Installation

## Python Resources

Python on wikipedia
Python Demo Codes
The Python Tutorial
Numerical Python (NumPy)
SciPy is a Python-based ecosystem of open-source software for mathematics, science, and engineering. Anaconda is a free Python distribution for Scientific Computing that includes over 100 of the most popular Python packages for science, math, engineering, data analysis. Unfortunately (at least on a Mac) it is not compatible with FEniCS.
Python source code for Langtangen's book "A Primer on Scientific Programming with Python

## FEniCS Demos

Several of you have had trouble using FEniCS plot command. Here is a work around that works nicely (at least for linear Lagrange elements).

A function, u, that is defined at the vertices of an unstructured 2D triangular mesh and is assumed to be linear on each triangle of the mesh can be represented using a set of points (x,y,z) where the points (x,y) are the vertices of the mesh and the z values are defined by z=u(x,y). Such a set of M points can be stored in an Mx3 matrix, XYZ. In addition, we need to know what the triangles in the mesh are. To specify K triangles we can use a Kx3 matrix, Tri, the k-th row of which is a triple of numbers in the range 1,2,3,...,M that specifies the indices of the rows of the matrix XYZ that form the vertices of the k-th triangle.

The python script linked to below generates the matrices XYZ and Tri for a FEniCS Function, u, defined on a Mesh. The matlab script reads in these matrices and uses matlab's trisurf function to plot the function, u.

Python and matlab scripts to use Matlab's trisurf function to plot a FEniCS Function defined using an unstructured mesh.

NOTE: If the FEniCS plot function does work for you, you can save your figure using the commands

viz=plot(u,interactive=-true)
viz.write_ps("filename",format="pdf")