# Numerical Methods and Statistics These are lecture notes and homeworks for a course taught at the University of Rochester by Andrew White in the Chemical Engineering Department. The course is taught using Jupyter Notebooks. View the course online: [whitead.github.io/numerical_stats/](https://whitead.github.io/numerical_stats/) ## Course Description This course provides an introduction to numerical methods and engineering statistics for chemical engineers. Students learn to use computer models and statistics to understand engineering systems. The focus of numerical methods is translating engineering problems into nalgorithms and implementing them in a spreadsheet or programming language. Topics covered include basic data structures, programming flow control, plotting, function minimization, integration and differential equations. The statistics portion teaches students basic probability theory, the central limit theorem, hypothesis testing, confidence intervals, regression, model fitting and basic error analysis. ## Projects See [project](project/) folder. ## Table of Contents #### [Unit 1](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_1) — Introduction [**Lecture 1**](unit_1/lectures/lecture_1.pdf): Sample Spaces, Probability Algebra of Samples, Events #### [Unit 2](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_2) — Probability [**Lecture 1**](unit_2/lectures/lecture_1.pdf): Combinations & Permutations, Multidimensional Sample Spaces, Random Variables, Continuous Probability Distributions [**Lecture 2**](unit_2/lectures/lecture_2.pdf): Marginals, Joints, Independence of Random Variables, Table of Useful Equations [**Lecture 3**](unit_2/lectures/lecture_3.pdf): Conditionals, Working with Joints/Marginals/Conditionals, Bayes' Theorem, Math Definition Independence, Compound Conditionals, Conditional Independence, Table of Useful Equations #### [Unit 3](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_3) — Python Basics [**Lecture 1**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_3/lectures/lecture_1.ipynb): Python Variables, String Formatting, Representing Integers [**Lecture 2**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_3/lectures/lecture_2.ipynb): Floating Point Representation, Python Booleans, Default Booleans, Floating Point Booleans, Lists, Slicing #### [Unit 4](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_4) — Python Basics, Expected Value [**Lecture 1**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_4/lectures/lecture_1.ipynb): List Methods, Range, Numpy Arrays, Python Tutor, For loops, Python Data Types (dictionaries, tuples, ints, floats), Function Arguments, Basic Plotting, Jupter Notebook Format [**Lecture 2**](unit_4/lectures/lecture_2.pdf): Expected Values and Variance, Conditional Expectation #### [Unit 5](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_5) — Probability Distributions [**Lecture 1**](unit_5/lectures/lecture_1.pdf): Bernoulli, Geometric, Binomial, Poisson, Exponential and Normal Distribution Equations [**Lecture 2**](unit_5/lectures/lecture_2.pdf): Probability of a Sample or Interval, Prediction Interval #### [Unit 6](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_6) — Python Program Flow [**Lecture 1**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_6/lectures/lecture_1.ipynb): Plotting - Basics, LaTeX, Point Markers, Vertical/Horizontal Lines, Legends [**Lecture 2**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_6/lectures/lecture_2.ipynb): Break Statement, While Loops, Discrete Distribution Prediction Intervals, Scipy Stats, Working with Probability and Prediction Intervals of Normal Distribution [**Lecture 3**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_6/lectures/lecture_3.ipynb): Defining Functions, Named Arguments, Default Function Arguments, Documenting Functions, #### [Unit 7](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_7) — Functions and Sample Statistics [**Lecture 1**](unit_7/lectures/lecture_1.pdf): Sample Statisics for 1D data: median, mean, mode, quartiles and quantiles. [**Lecture 2**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_7/lectures/lecture_2.ipynb): Presenting Results and Precision, Calculating Sample Statistics, Visualizing 1D data with histograms, Caclulating Sample Statistics with Categories, Visualizing Categorical 1D data with Boxplots and Violin Plots. [**Lecture 3**](unit_7/lectures/lecture_3.pdf): Sample Statisics for 2D data: Sample Covariance, Sample Correlation. [**Lecture 4**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_7/lectures/lecture_4.ipynb): Plotting 2D data (scatter plot) and computing sample covariance/correlation #### [Unit 8](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_8) — Central Limit Theorem and Confidence Intervals [**Lecture 1**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_8/lectures/lecture_1.ipynb): Central Limit Theorem and Theory of Confidence Intervals [**Lecture 2**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_8/lectures/lecture_2.ipynb): Computing Confidence Intervals #### [Unit 9](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_9) — Linear Algebra in Python [**Lecture 1**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_9/lectures/lecture_1.ipynb): Python Tips & Tricks [**Lecture 2**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_9/lectures/lecture_2.ipynb): Matrix Algebra (`linalg`), Solving Systems of Equations, Eigenvector/Eigenvalue, Matrix Rank [**Lecture 3**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_9/lectures/lecture_3.ipynb): Numerical Differentiation, Numerical Integration via Trapezoidal Rule, Numerical Integration in Scipy, Anonymous Functions (`lambda`) #### [Unit 10](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_10): — Hypothesis Testing [**Lecture 1**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_10/lectures/lecture_1.ipynb): Introduction to Hypothesis Testing, the zM and Student's t-Test [**Lecture 2**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_10/lectures/lecture_2.ipynb): Non-Parametric Statistics, Reading a CSV file in Pandas, Wilcoxon Sum of Ranks, Wilcoxon Signed Rank, Poisson Test, Binomial Test #### [Unit 11](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_11) — Optimization [**Lecture 1**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_11/lectures/lecture_1.ipynb): Common mistakes with functions, Scope, Root Finding in 1D, Minimization in 1D, Convexity [**Lecture 2**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_11/lectures/lecture_2.ipynb): Root finding in multiple dimensions, Minimization in multiple dimensions, Bounded Optimization, Non-convex Optimization #### [Unit 12](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_12): — Regression [**Lecture 1**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_12/lectures/lecture_1.ipynb): Shapiro-Wilk Normality Test, Ordinary Least-Squares Linear Regression in 1- (OLS-1D) and N dimensions (OLS-ND), Standard error, Uncertainty in OLS-1D, OLS-ND, Fit coefficient hypothesis tests, Fit coefficient confidence intervals, Overview of steps to justify and perform regression (bottom of lecture) [**Lecture 2**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_12/lectures/lecture_2.ipynb): Non-linear regression and error analysis. Deconvoluting spectrum example. [**Lecture 3**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_12/lectures/lecture_3.ipynb): Regressing categorical data with discrete domains [**Lecture 4**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_12/lectures/lecture_4.ipynb): Regressing with constant uncertainty/measurement error in independent and/or dependent variables #### [Unit 13](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_13): — Differential Equations & Uncertainty Propagation [**Lecture 1**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_13/lectures/lecture_1.ipynb): Standard form and categorizing differential equations, Solving ODEs [**Lecture 2**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_13/lectures/lecture_2.ipynb): Error propagation through numerical derivatives, statistical fallacies #### [Unit 14](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_14): — Applied Python - Working with Data [**Lecture 1**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_14/lectures/lecture_1.ipynb): Dealing with duplicate, missing, NaN, non-contiguous, out of order data, Joining datasets, Using Pandas, Using Seaborn, Computing Running Means [**Lecture 2**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_14/lectures/lecture_2.ipynb): Packaging and deploying Python modules #### [Unit 15](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_15): — What to do now [**Lecture 1**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_15/lectures/lecture_1.ipynb): Next steps to learn more about numerical methods, statistics, and programming #### [Unit 16](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_16): — MATLAB [**Lecture 1**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_16/lectures/lecture_1.ipynb): An overview of MATLAB, the Jupyter Hub server and Excel #### [Unit 17](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_17): — User Interfaces [**Lecture 1**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_17/lectures/lecture_1.ipynb): Creating and writing animations [**Lecture 2**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_17/lectures/lecture_2.ipynb): Introduction to HTML, CSS, JS and modifying notebook style #### [Unit 18](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_18): — Design of Experiments [**Lecture 1**](https://nbviewer.jupyter.org/github/whitead/numerical_stats/blob/master/unit_18/lectures/lecture_1.ipynb): Tables of experiments, vocabulary of design of experiments, ANOVA, factorial design, fractional factorial design, nuisance factors, blocking