diff --git a/lint.txt b/lint.txt new file mode 100644 index 00000000..f474e7d6 --- /dev/null +++ b/lint.txt @@ -0,0 +1,987 @@ + + +FILE: ./notebooks/01-publish/00-Python-Primer.ipynb + # Python Primer + ## Why Python? + WARNING: https://spectrum.ieee.org/static/interactive-the-top-programming-languages-2019 is not reachable, status_code: 404 + ## Chapter Learning Objectives + ## Activities + + +FILE: ./notebooks/01-publish/01-Jupyter-Notebooks.ipynb + # Welcome to Jupyter Notebooks and Vocareum + ## Quick Python Introduction + ### Variables + ### Execution Order + ## Vocareum Autograder + ### Our First Autograded Submission + + +FILE: ./notebooks/01-publish/02-Python-Basics-I-Variables-Strings-Bugs.ipynb + # Python Basics I: Variables, Strings, and Bugs + ## Learning Objectives + ## Hello World and Interactive Sessions + ### Command Line Mode + ## Comments + ## Errors + ### "Good" Bugs + ### "Bad" Bugs + ## Indentation + ## Input + ## Variables + ### Integers + ### Floating Point Numbers + ### Built-in Mathematical Functions + ## Strings and Overloading + + +FILE: ./notebooks/01-publish/03-Flow-control.ipynb + # Python Basics II: Loopy Logic + ## Learning Objectives + ## If Statements + ## Iteration with While Loops + ## For Loops + + +FILE: ./notebooks/01-publish/03b-Pseudocode.ipynb + # Pseudocode + ## Learning Objectives + ## Pseudocode + ## Estimate $\pi$ by throwing darts + ### Governing Formula + ### Pseudocode + #### Python Implementation + #### Python + ### Using Help to Learn More About a Function + ### Another Solution Approach - With Plots + ## TODO: Add another pseudocode example + + +FILE: ./notebooks/01-publish/04-Functions-and-Scope.ipynb + # Functions and Scope + ## Learning Objectives + ## Functions + ### Calling functions + ### Return Values + ### Docstrings and Help + ## Scope + + +FILE: ./notebooks/01-publish/04b-Recursion.ipynb + # Recursion + ## Learning Objectives + ## Recursion + ERROR: http://justinwhite.com/big-calc/1000.html HTTPConnectionPool(host='justinwhite.com', port=80): Max retries exceeded with url: /big-calc/1000.html (Caused by ConnectTimeoutError(, 'Connection to justinwhite.com timed out. (connect timeout=10)')) + + +FILE: ./notebooks/01-publish/04c-Modules-and-Files.ipynb + # Functions, Scoping, and Other Fun Stuff + ## Learning Objectives + ## Modules + ## Files + + +FILE: ./notebooks/01-publish/04d-Example-High-Low-Game.ipynb + # High/Low Guess My Number Game + ## Your Function + ## Test 1 + ## Test 2 + + +FILE: ./notebooks/01-publish/05-Python-Basics-III-Lists-Dictionaries-Enumeration.ipynb + # Python Basics III: Lists, Dictionaries, and Enumeration + ## Learning Objectives + ## Lists + ## Dictionaries + ### Example: Shopping List + ### Another Example: Chemical Symbols and Element Names + ### Dictionary of Dictionaries + ## Enumerate + ### Lists + ### Dictionaries + + +FILE: ./notebooks/01-publish/06-NumPy.ipynb + # Linear Algebra with Numpy and Scipy + ## Learning Objectives + ## NumPy Arrays + ### Getting Started + ### Creating Arrays in Neat Ways + ### Operations on Arrays + ### Universal Functions + ### Copying Arrays + ### Indexing, Slicing, and Iterating + ### Complex Numbers + ### Integrating Everything Together + + +FILE: ./notebooks/01-publish/07-Matplotlib.ipynb + # Visualization with matplotlib + ## Learning Objectives + ## Matplotlib Basics + ### Customizing Plots + ### Plotting multiple lines + ## Publication Quality Figures + + +FILE: ./notebooks/01-publish/08-Pandas.ipynb + # Manipulating Data with Pandas + ## Learning Objectives + ## Working with Data Using Pandas + WARNING: https://pandas.pydata.org/pandas-docs/stable/getting_started/10min.html is not reachable, status_code: 404 + ### Loading and Inspecting Data + ### Computing Summary Statistics + ### Combining Pandas and Matplotlib + ## Investment Strategies + ### Getting Started + ### Portfolio Calculator + + +FILE: ./notebooks/01-publish/09-Functions-as-Arguments.ipynb + # Functions as Arguments + ## Learning Objectives + ## Functions passed to Functions + ## Lambda Functions + ## Tying it all together: Midpoint Integration + ### Convergence Analysis + ### A Fancier Integration Function + ### Incorporating Lambda Functions with Midpoint Integration + ### Extension to Two Dimensional Functions + + +FILE: ./notebooks/01-publish/10-Testing-and-Debugging.ipynb + # Testing and Debugging in Python + ### Learning Objectives + ## Testing Your Code + ### Motivating Example + ### Test 0: Takes Inputs as Advertised? + ### Test 1: Initial Condition + ### Test 2: Asymptotics + ### Test 3: Check a Few Inputs + # Debugging + ### Debugging is a Mindset + ### Test 2 + ### Test 3 + # Assertions + # Error Handling + + +FILE: ./notebooks/02-publish/01-Modeling-Systems-of-Linear-Equations.ipynb + # Modeling Systems of Linear Equations + ## Learning Objectives + ## Introduction + ## Environmental Controls for a Power Plant + WARNING: https://ndcbe.github.io/data-and-computing/_images/wet_fgd3.png is not reachable, status_code: 404 + ### Determine Additional Data and Analysis Goal + WARNING: https://ndcbe.github.io/data-and-computing/_images/wfgd-table.png is not reachable, status_code: 404 + WARNING: https://ndcbe.github.io/data-and-computing/_images/henrys_law2.png is not reachable, status_code: 404 + ### Draw a Picture + WARNING: https://ndcbe.github.io/data-and-computing/_images/single_stage_model.png is not reachable, status_code: 404 + ### State Assumptions + ### Mathematical Model + ### Degree of Freedom Analysis + ### Revised Model + ### Calculations + ### Final Result and Discussion + ## FGD Revisited with Linear Algebra + ### Rewrite Model as a Linear System + ### Solve Linear System with Python + ### Perform Sensitivity Analysis to Determine L + + +FILE: ./notebooks/02-publish/02-Gauss-Elimination.ipynb + # Gaussian Elimination + ## Learning Objectives + ## Linear Algebra: Invertible Matrix Theorem + ## Motivating Example and Gaussian Elimination + ### Gaussian Elimination: Take Care of First Column + ### Gaussian Elimination: Take Care of Second Column + ## Motivating Example and Back Substitution + ### Verify Solution + ## Generalized Gaussian Elimination + ### Pseudocode + ### Python Implementation + ### Unit Test: Motivating Example + ## Generalized Back Substitution + ### Pseudocode + ### Python Implementation + ## Additional Testing: Random Linear Systems + ## Round off and Pivoting + ### Swapping Rows + ### Selecting Pivot + ### Put it All Together + ### Unit Test: Motivating Example + ### Unit Test: Troublesome System + ## Timing + ## Mass Balance Example (Adapted from an Old Exam Problem) + WARNING: https://ndcbe.github.io/data-and-computing/_images/1b_fig.png is not reachable, status_code: 404 + ### Mathematical Model (Old Exam Question) + ### Matrix Form (Old Exam Question) + ### Solve with Gaussian Elimination + ### Flip the order of the row + ### Replace the 8th equation with an overall mole balance + + +FILE: ./notebooks/02-publish/03-LU-Factorization.ipynb + # LU Decomposition and Condition Number + ## Learning Objectives + ## Motivation: Solving the "Same" System Multiple Times + ## LU Factorization + ### Our First Function for LU Factorization + ### A More Memory Efficient Version + ## Solving Linear Systems + ### Our First Function for Forward and Backward Solves + ### Another Implementation (Optional) + ## LU with Pivoting + ## Errors in Linear Systems + ### Rank of the Matrix + #### Example 2 + #### Example 3 + ### Singular Value Decomposition + ### Condition Number + ## Take Home Messages + + +FILE: ./notebooks/02-publish/04-Example-Atomic-Mass-Balances.ipynb + # Example: Mass Balances and Linear Algebra + ## Learning Objectives + ## Atomic Species (Mass) Balance + + +FILE: ./notebooks/03-publish/01-Taylor-Series.ipynb + # Taylor Series Approximations + ## Learning Objectives + ## Motivation + ### Class Roadmap + ## Calculus Revisited: Derivatives and Taylor Series + ### The definition of a derivative + ### Taylor Series and Big-O notation + ### Example: Approximating Cosine + + +FILE: ./notebooks/03-publish/02-Finite-Difference.ipynb + # Finite Difference Derivative Approximations + ## Learning Objectives + ## Forward Finite Difference + ## Backward Finite Difference + ### Example to Compare the Approximations + ## Higher-order Approximations + ### Central Difference Formula + ### Comparison of the approximations + ## Truncation and Random Errors + ### Forward Difference + ### Backward Difference + ### Central Difference + ### Second (and Higher) Derivatives + + +FILE: ./notebooks/03-publish/03-Example-Heating-a-Metal-Slab.ipynb + # Example: Heating a Metal Slab + ## Learning Objectives + WARNING: https://ndcbe.github.io/data-and-computing/_images/metal-slab.png is not reachable, status_code: 404 + ### Algorithm (Truncation) Error + ### Random Error + ### Optimal Location + ### Visualize the Results + + +FILE: ./notebooks/04-publish/01-Modeling-Systems-of-Nonlinear-Equations.ipynb + # Modeling Systems of Nonlinear Equations + ## Learning Objectives + ## Flash Calculations + WARNING: https://ndcbe.github.io/data-and-computing/_images/flash-system.png is not reachable, status_code: 404 + ### Full Mathematical Model + ### Solve Nonlinear System with Python + + +FILE: ./notebooks/04-publish/02-Newton-Method-Nonlinear-Equation-Solving.ipynb + # Solving Systems of Nonlinear Equations with Newton's Method + ## Learning Objectives + ## Motivation + ## Newton's Method (aka Newton-Raphson Method) with an Example + ### Main Idea Through an Example + ### Algorithm Steps and Iteration 1 + ### Convergence + ### Iteration 2 + ## Newton's Method Generalized + ### Generalization + ### Algorithm and Implementation + ### Unit Test and Example + ### Looking Deeper into the Unit Test + #### Iteration 1 + #### Iteration 2 + #### Iteration 3 + + +FILE: ./notebooks/04-publish/03-More-Newton-Type-Methods.ipynb + # More Newton-Type Methods + ## Learning Objectives + ## Inexact Newton + ### Unit Test + ## Secant Method + ### Iteration 1 + ### Iteration 2 + ### Secant Method Algorithm + + +FILE: ./notebooks/04-publish/04-Convergence-Analysis-Newton-Method.ipynb + # Convergence Analysis for Newton's Method + ## Learning Objectives + ## Examples of slow convergence + ### Example 1: Multiple Roots, overlapping + ### Example 2: Multiple roots, spaced far apart + ### Example 3: Complex roots near the real root + #### Iteration 1 + #### Iteration 2 + #### Iteration 3 + ### Iteration 4 + + +FILE: ./notebooks/04-publish/05-System-of-Equations-Newton-Method.ipynb + # Newton's Method for Systems of Equations + ## Learning Objectives + ### Motivation: Flash Problem Revisited + WARNING: https://ndcbe.github.io/data-and-computing/_images/flash-system.png is not reachable, status_code: 404 + ### Extending Newton's Method to Multiple Dimensions + ### Two Phase, Single Feed Phase Problem + #### Convert to Canonical Form + #### Assemble Jacobian Matrix (Analytic) + #### First Iteration + ### Finite Difference to Approximate the Jacobian Matrix + ### Putting it all together: Multivariate Newton's Method + ### Return to the Two Phase Flash Calculation + ### Now let's break it + ### Using ``numpy`` instead + + +FILE: ./notebooks/05-publish/01-Pyomo-Basics.ipynb + # Pyomo Basics + ## Learning Objectives + ## Overview + WARNING: https://www.sciencedirect.com/science/article/pii/S0098135404001565?casa_token=vO761nMJ9CwAAAAA:rThzdy07Zgoi9Y5Bd7soAJnwbILWHQZ2zzN4rsvujeWjEyyfew_rXVgbAuuYdTGrDKbj9-JbLgQ is not reachable, status_code: 403 + WARNING: https://aiche.onlinelibrary.wiley.com/doi/abs/10.1002/prs.12103?casa_token=t7j78jzYFyMAAAAA:MDnYJdgSrlNsniudvbMQEdo8gqBLOnYMK06yCgyMsVnX3Fm8BLo2G8b3RU_gZyFFg4bUrFVwRYKrkBg is not reachable, status_code: 503 + ## Constrained Nonlinear Optimization: Canonical Form + ## Pyomo in an Example + ### Declare Model + ### Solve Numerically + ### Visualize Solution + ## Example: Planting Cherry Trees + ### Step 1: Develop Mathematical Model, Convert to Canonical Form + ### Step 2: Solve in Python + ### Interpret Answer + + +FILE: ./notebooks/05-publish/02-Electricity-Market-Optimization.ipynb + # Electricity Market Optimization + ## Learning Objectives + ## Optimal Operation of Battery Energy Storage + ### Visualize Price Data + ### Create Mathematical Model + WARNING: https://ndcbe.github.io/data-and-computing/_images/battery.png is not reachable, status_code: 404 + ### Define Pyomo Model + ### Solve Optimization Model + ### Extract Solution from Pyomo + ### Plot Results + ### How much money can a 4 MWh battery make in a year? + + +FILE: ./notebooks/05-publish/03-Flash-Calculations-in-Pyomo.ipynb + # Flash Calculations in Pyomo + ## Learning Objectives + ## Flash Example Revisited + WARNING: https://ndcbe.github.io/data-and-computing/_images/flash-system.png is not reachable, status_code: 404 + + +FILE: ./notebooks/06-publish/01-Intro-and-Newton-Cotes.ipynb + # Introduction and Newton-Cotes + ## Learning Objectives + ## Motivating Example and Main Idea + ### Example: Integrate Normal Distribution + WARNING: https://ndcbe.github.io/data-and-computing/_images/sat.jpg is not reachable, status_code: 404 + ### Example: Let's Revisit that Unbounded Assumption + ### Main Idea + ## Newton-Cotes Formulas + ### 1) Midpoint Rule + ### 2) Trapezoid Rule + #### Trapezoid Rule with Multiple Pieces + #### General Purpose Function and Test Case + #### Error Analysis + ### Simpson's Rule + #### Quadratic Interpolation + #### General Purpose Function and Test Case + #### Error Analysis + #### Another Example: Approximating $\pi$ + + +FILE: ./notebooks/06-publish/02-Gauss-Quadrature.ipynb + # Gauss Quadrature + ## Learning Objectives + ## Gauss Quadrature Rules + #### Integral Bounds Transformation + #### Transformation Example + ### Integrate a Linear Function + ### Weights and Nodes + #### Where did these points come from? (optional) + ### Code for Gauss-Legendre Quadrature + ### Visualize Quadrature Weights + ### Polynomial Example + ### Sine Example Revisited + ### A More Complicated Example + + +FILE: ./notebooks/06-publish/03-Adaptive-Methods-and-Scipy.ipynb + # Adaptive Methods for Newton-Cotes and Gauss Quadrature, Scipy Library + ## Learning Objectives + ## Adaptive Methods Overcome Certain Limitations + ### Scipy Documentation + + +FILE: ./notebooks/06-publish/04-Application-Inertial-Navigation-Systems.ipynb + # Application: Inertial Navigation Systems + ## Learning Objectives + ## Appliction: Inertial Navigation Systems + ### Preliminary Analysis + ### Free Body Diagram & Acceleration + ### Velocity + ### Position + + +FILE: ./notebooks/06-publish/05-Forward-and-Backward-Euler.ipynb + # Forward and Backward Euler Methods + ## Learning Objectives + ## Main Idea + ## Forward (Explicit) Euler + ### Main Idea + ### Generalization and Python Implementation + ### Test Problem + ### Impact of Step Size on Integration Error + ## Backward (Implicit) Euler + ### Main Idea + ### Python Implementation + ### Impact of Step Size on Integration Error + + +FILE: ./notebooks/06-publish/06-Trapezoid-Rule.ipynb + # Crank-Nicolson (Trapezoid Rule) + ## Learning Objectives + ## Main Idea + # Crank-Nicolson (aka Trapezoid Rule) + ### Main Idea + ### Python Implementation + ### Impact of Step Size on Integration Error + ### Stability and Oscillations + + +FILE: ./notebooks/06-publish/07-Stability-Analysis.ipynb + # Stability Analysis of Forward/Backward Euler and Crank-Nicolson Methods + ## Learning Objectives + ## Comparison of Forward/Backward Euler and Crank-Nicolson on a more complicated problem + ## Stability + ### Forward (Explicit) Euler Stability Analysis + #### Solving for the Growth Rate to Determine Stability + ### Backward (Implicit) Euler Stability Analysis + #### Solving for the Growth Rate to Deterimine Stability + ### Crank-Nicolson (Trapezoid) Method + #### Solving for the Growth Rate to Determine Stability + + +FILE: ./notebooks/06-publish/08-Explicit-Runge-Kutta.ipynb + # Explicit Range Kutta Method + ## Learning Objectives + ## Fourth-order (Explicit) Runge-Kutta Method + + +FILE: ./notebooks/06-publish/09-Systems-of-Differential-Equations-and-Scipy.ipynb + # Systems of Differential Equations and Scipy + ## Learning Objectives + ## Systems of Differential Equations + ### Forward (Explicit) Euler + ### Backward (Explicit) Euler + ### Crank-Nicolson + ### Runge-Kutta + ## Scipy + + +FILE: ./notebooks/06-publish/10-Example-Reaction-Rates.ipynb + # Example: Reaction Rates + ## Learning Objectives + ### Linear Differential Equation System + ### Linear Differential Equation System + ### Numerically Integrate using Class Implementation + #### Forward Euler + #### Backward Euler + #### Crank-Nicolson + #### Runge-Kutta + ### Numerically Integrate using Scipy + + +FILE: ./notebooks/07-publish/01-Sampling.ipynb + # Sampling + ## Learning Objectives + ## Sampling + ### Conceptual versus Tangible Populations + ### Independence + + +FILE: ./notebooks/07-publish/02-Summary-Statistics.ipynb + # Summary Statistics + ## Learning Objectives + ## Summary Statistics + ### Two Types of Data: Numerical and Categorical + ### Sample Mean + ### Sample Variance and Standard Deviation + ### Sample Median + ### Sample Mode and Range + ### Quartiles and Percentiles + ### Multivariate Data Example: Exam 1 Scores + ### Sample Covariance + ### Summary Statistics for Categorical Variables + ### Summary Statistics and Population Parameters + + +FILE: ./notebooks/07-publish/03-Visualizing-Data.ipynb + # Visualizing Data + ## Learning Objectives + ## Visualizing Data + ### Scatter Plots + ### Example: Old Faithful + ### Histogram + ### Boxplot + WARNING: https://miro.medium.com/max/18000/1 is not reachable, status_code: 404 + ### Visualization Practice: Exam Scores + + +FILE: ./notebooks/08-publish/01-Random-Variables.ipynb + # Random Variables + ## Data Analysis Intro + ## Learning Objectives + ## Statistics: Using Data to ... + ### 1. Describe the World + ### 2. Draw Conclusions (Inferences) + ### 3. Make Decisions Under Uncertainty + ## Random Variables + ### Example for Discrete Random Variables: Flipping Two Independent Coins + ### Another Example: Continous Random Variables + #### Uniform Distribution + + +FILE: ./notebooks/08-publish/02-Jointly-Distributed-Random-Variables.ipynb + # Jointly Distributed Random Variables + ## Learning Objectives + ## Jointly Distributed Random Variables + ### Example: Independent Random Variables + #### Simulating Two Dependent/Correlated Coins + + +FILE: ./notebooks/08-publish/03-Practice-Problems.ipynb + # Practice Problems + ## Basic Ideas of Probability + ### Practice Problem 2.1-A + ### Practice Problem 2.1-B + ### Practice Problem 2.1-C + ## Counting Methods + ### Practice Problem 2.2-A + ### Practice Problem 2.2-B + ### Practice Problem 2.2-C + ### Practice Problem 2.2-D + ### Practice Problem 2.2-E + ## Conditional Probability and Independence + ### Practice Problem 2.3-A + ### Practice Problem 2.3-B + ### Practice Problem 2.3-C + ### Practice Problem 2.3-D + ### Practice Problem 2.3-E + ### Practice Problem 2.3-F + ## Random Variables + ### Practice Problem 2.4-A + ### Practice Problem 2.4-B + ## Jointly Distributed Random Variables + ### Practice Problem 2.6-A + ### Practice Problem 2.6-B + + +FILE: ./notebooks/09-publish/01-Bernoulli-Probability-Distribution.ipynb + # Bernoulli Probability Distribution + ## Learning Objectives + ## Bernoulli Distribution + + +FILE: ./notebooks/09-publish/02-Binomial-Probability-Distribtuion.ipynb + # Binomial Probability Distributions + ## Learning Objectives + ## Binomial Distribution + ### Flipping Three Coins + + +FILE: ./notebooks/09-publish/03-Poisson-Probability-Distribution.ipynb + # Poisson Probability Distributions + ## Learning Objectives + ## Poisson Distribution + ### Example: Failure Rates + + +FILE: ./notebooks/09-publish/04-Normal-Probability-Distribution.ipynb + # Normal Probability Distributions + ## Learning Objectives + ## Normal Distribution + ### 68-95-99.7 Rule + WARNING: https://miro.medium.com/max/24000/1 is not reachable, status_code: 404 + ### Standardization + ### Example: Using the Z-Table + #### What is the probability the next pizza coming off the manufacturing line has more than 10.4 grams of fat? + #### The FDA would like you to certify that 99% of frozen pizzas have fat content between $\underline{\qquad \qquad}$ and $\underline{\qquad \qquad}$ grams, where the interval in centered at the mean. Fill in the blanks. + ### Example: Modeling Stocks + #### Approach 1: Numerically integrate the pdf + #### Approach 2: Standardize and use function for standard normal distribution + + +FILE: ./notebooks/09-publish/05-Common-Probability-Distributions-Summary.ipynb + # Common Probability Distributions Summary + ## Learning Objectives + + +FILE: ./notebooks/10-publish/01-Measurement-Error.ipynb + # Measurement Error + ## Learning Objectives + ## Measurement Error + + +FILE: ./notebooks/10-publish/02-Error-Propagation.ipynb + # Error Propagation + ## Learning Objectives + ## Error Propagation + ### Addition and Subtraction + ### Multiplication and Division Rule + #### Division Rule + ### Differentiable Function + + +FILE: ./notebooks/10-publish/03-Measuring-Flowrate-Example.ipynb + # Measuring Flowrate Example + ## Learning Objectives + ### Example: Measuring Flowrate + #### Approach 1: Division Rule + #### Approach 2: Differentiable Function Rule + + +FILE: ./notebooks/10-publish/04-Practice-Problems.ipynb + # Practice Problems + ## Learning Objectives + ### Practice Problem A + ### Practice Problem B + ### Practice Problem C + + +FILE: ./notebooks/10-publish/05-Simulation.ipynb + # Simulation + ## Learning Objectives + ## Simulation + ### Using Simulation to Estimate a Probability + ### Using Simulation to Estimate Means and Variances + ### Using Simulation to Determine Whether a Population is Approximately Normal + ### Practice Problem 4 + + +FILE: ./notebooks/11-publish/01-Central-Limit-Theorem.ipynb + # Central Limit Theorem + ## Learning Objectives + ## Central Limit Theorem + ### Numerical Illustrations of Central Limit Theorem + WARNING: https://www.stat.berkeley.edu/~mlugo/stat134-f11/clt-proof.pdf is not reachable, status_code: 404 + #### Samples from Uniform Distribution + #### Samples from Bimodal Distribution + ### CLT Illustrative Example: Membrane Defects + #### Expected Value of Defects + #### Variance of Defects + #### Standard Deviation of Number of Defects + #### Probability + + +FILE: ./notebooks/11-publish/02-Standard-Normal-Distribution.ipynb + # Standard Normal Distribution + ## Learning Objectives + ## CLT Illustrative Example: Membrane Defects + #### Expected Value of Defects + #### Variance of Defects + ## Standardized Normal Distribution + WARNING: https://ndcbe.github.io/data-and-computing/_images/zscore-plot.png is not reachable, status_code: 404 + + +FILE: ./notebooks/11-publish/03-Confidence-Intervals.ipynb + # Confidence Intervals + ## Learning Objectives + ## Motivating Example: Catalyst Life + ## Confidence Interval + ### 68-95-99.7 Rule + WARNING: https://ndcbe.github.io/data-and-computing/_images/68-95-99.7.png is not reachable, status_code: 404 + ### Confidence Interval Formula + ### Catalyst Life Example + + +FILE: ./notebooks/11-publish/04-Students-t-Distribution.ipynb + # Student's t-Distribution + ## Learning Objectives + ## Student's t-Distribution + ### Main Idea + ### Degrees of Freedom and Visualization + WARNING: https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Student_t_pdf.svg/960px-Student_t_pdf.svg.png is not reachable, status_code: 403 + WARNING: https://upload.wikimedia.org/wikipedia/commons/thumb/e/e7/Student_t_cdf.svg/960px-Student_t_cdf.svg.png is not reachable, status_code: 403 + ### Comparison of $z^*$ and $t^*$ + ### Catalyst Example Revisited + ### Important Assumptions: Population is Normally Distributed, Samples are Random + ERROR: https://drive.google.com/uc?export=view&id=1izl_-WD7yZk40QA3F9wHeiRd9V6-SMyW HTTPSConnectionPool(host='doc-0c-4o-docs.googleusercontent.com', port=443): Read timed out. (read timeout=10) + + +FILE: ./notebooks/11-publish/05-First-Hypothesis-Testing.ipynb + # First Hypothesis Testing + ## Learning Objectives + ## Hypothesis Testing + ### Motivating Example: Catalyst Lifetime + ### Null and Alternative Hypotheses + ### Hypothesis Testing Procedure + #### Step 1. Define Hypotheses. + #### Step 2. Assume $H_0$ is True. + #### Step 3. Compute the Test Statistic. + #### Step 4. Calculate P-Value. + #### Step 5. State Conclusions + ### Summary of Hypotheses and P-Values + + +FILE: ./notebooks/11-publish/06-Hypothesis-Testing-Review-and-Type-I-Type-II-Errors.ipynb + # Hypothesis Testing Review and Type I/Type II Errors + ## Learning Objectives + ## Review Hypothesis Testing Conclusions + ### Test your Understading + ## Type I and Type II Errors for Statistical Inference + ### Example: Law and Order + WARNING: https://drive.google.com/uc?export=view&id=1vZyz1Dxf3SEJhxKvQGjuyP3l3Lgwg9_l is not reachable, status_code: 403 + + +FILE: ./notebooks/11-publish/07-Flavors-of-Hypothesis-Testing.ipynb + # Flavors of Hypothesis Testing + ## Introduction + ## Learning Objectives + ## Small-Sample Test for Population Mean + ### Step 1. Define Hypotheses. + ### Step 2. Assume $H_0$ is True. + ### Step 3. Compute the Test Statistic. + ### Step 4. Calculate P-Value. + ### Step 5. State Conclusions. + ## Small-Sample Difference Between Two Means + ### Step 1. Define Hypotheses. + ### Step 2. Assume $H_0$ is True. + ### Step 3. Compute the Test Statistic. + ### Step 4. Calculate the P-Value. + ### Step 5. State Conclusions. + ## Small-Sample Different Between Pairwise Means + ### Step 1. Define Hypotheses. + ### Step 2. Assume $H_0$ is True. + ### Step 3. Compute the Test Statistic. + ### Step 4. Calculate P-Value. + WARNING: https://ndcbe.github.io/data-and-computing/_images/one-sided-left.png is not reachable, status_code: 404 + WARNING: https://ndcbe.github.io/data-and-computing/_images/two-sided.png is not reachable, status_code: 404 + WARNING: https://ndcbe.github.io/data-and-computing/_images/one-sided-right.png is not reachable, status_code: 404 + ### Step 5. State Conclusions. + ## Population Proportion + ### Motivating Example + ### Step 1. Define Hypotheses. + ### Step 2. Assume $H_0$ is True. + ### Step 3. Compute the Test Statistic. + ### Step 4. Calculate P-Value. + ### Step 5. State Conclusions. + + +FILE: ./notebooks/11-publish/08-Statistical-Power-Basics.ipynb + # Statistical Power Basics + ## Learning Objectives + ## Statistical Power + ### Motivating Example + ### Step 1. Fix the experiment design, make assumptions. + ### Step 2. Compute the rejection region. + WARNING: https://drive.google.com/uc?export=view&id=1eiJt3uTmYLbOJVQOZ_P3vTo0ESa5tbpl is not reachable, status_code: 403 + ### Step 3. Compute the statistical power. + ### Activity: Question 1 + ### Activity: Question 2 + + +FILE: ./notebooks/11-publish/09-Statistical-Power-in-Python.ipynb + # Statistical Power in Python + ## Learning Objectives + ## Exploring Statistical Power in Python + + +FILE: ./notebooks/11-publish/10-Statistical-Power-Practice-Problems.ipynb + # Statistical Power Practice Problems + ## Learning Objectives + ## Practice Problems + ### Practice Problem A + ### Practice Problem B + ### Practice Problem C + + +FILE: ./notebooks/12-publish/01-Ordinary-Least-Squares-Linear-Regression.ipynb + # Ordinary Least Squares Linear Regression + ## Learning Objectives + ## Correlation + ## The Best Fit Line + ## Motivating Example for Linear Regression + ### Linear Regression Basics + ### Optimization Formulation + ### Analytic Solution + ### Scipy Package + ### Visualize + ## Residual Analysis + ### Calculate Residuals + ### Histogram of Residuals + ### Scatter Plot of Residuals versus Predicted Values + WARNING: https://drive.google.com/uc?export=view&id=18C0Lsiy5xXUWXGZ3shsKsv3CnsjufU-n is not reachable, status_code: 403 + ### Scatter Plot of Residuals versus Independent Variable + WARNING: https://drive.google.com/uc?export=view&id=1BobcdQP4SWK4kEeEcvWUAxTK9P_QDsic is not reachable, status_code: 403 + ### Scatter Plot of Residuals versus Data Collection Order + ### Scatter Plot of Residuals Squared versus Independent Variable (and Collection Order) + WARNING: https://drive.google.com/uc?export=view&id=15--jigLRrNUq6TBzIraahIfzpvsJaZfN is not reachable, status_code: 403 + WARNING: https://drive.google.com/uc?export=view&id=1Hu6PEXeZqkUJ2w6mcdXNk6oqXH6k1HL5 is not reachable, status_code: 403 + WARNING: https://drive.google.com/uc?export=view&id=1SJzBRLdtv1oqmhLhfZsYsSlLH17_-5GI is not reachable, status_code: 403 + ### What if an assumption is violated? + #### Plot and Best Fit + #### Reisdual Analysis: Part 1 + #### Residual Analysis: Part 2 + + +FILE: ./notebooks/12-publish/02-Uncertainty-Analysis-and-Statistical-Inference.ipynb + # Uncertainty Analysis and Statistical Inference + ## Learning Objectives + ## Uncertainty Analysis and Statistical Inference + ### Estimating Variance of Residuals + ### Simplified Uncertainty in Regression Parameters + ### Confidence Intervals + ### Uncertainty in Regression Parameters Revisited + + +FILE: ./notebooks/12-publish/03-Linear-Regression-Practice-Problems.ipynb + # Linear Regression Practice Problems + ## Learning Objectives + ## Supplemental Exercise 7.5 (Navidi 2015) + ## Supplemental Exercise 7.8 (Navidi 2015) + + +FILE: ./notebooks/12-publish/04-Multivariate-Linear-Regression.ipynb + # Multivariate Linear Regression + ## Learning Objectives + ## Multivariate Regression + ### Motivating Example: Predict Bluegills Age + ERROR: https://newonlinecourses.science.psu.edu/stat501/node/325/ HTTPSConnectionPool(host='newonlinecourses.science.psu.edu', port=443): Max retries exceeded with url: /stat501/node/325/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))) + ### Normal Equations + ### Attempt 1. Linear Model + ### Attempt 2. Quadratic Model + ### How to select the best model? + + +FILE: ./notebooks/13-publish/01-Transformations-and-Linear-Regression.ipynb + # Transformations and Linear Regression + ## Learning Objectives + ## Introduction + ### Motivating Example and Dataset + ## Transformation and Linear Regression + ### Step 1: Calculate Best Fit and Plot + ### Step 2. Residual Analysis + #### Calculate Residuals + #### Histogram of Residuals + #### Scatter Plots of Residuals + ### Step 3. Uncertainty Analysis / Calculate Covariance Matrix + ### Final Thoughts + + +FILE: ./notebooks/13-publish/02-Nonlinear-Regression.ipynb + # Nonlinear Regression + ## Learning Objectives + ## Nonlinear Regression + ### Step 1: Calculate Best Fit and Plot + ### Step 2: Residual Analysis + ### Step 3. Uncertainty Analysis / Calculate Covariance Matrix + + +FILE: ./notebooks/13-publish/03-Nonlinear-Regression-Practice-Problem.ipynb + # Nonlinear Regression Practice Problem + ## Learning Objectives + ## Nonlinear Regression Practice Problem + ### Transform Model Parameters + ### Perform Nonlinear Regression + ### Plot Residuals and Fitted Model + ### Covariance Matrix + ### Final Thoughts + + +FILE: ./notebooks/13-publish/04-Weighted-Regression.ipynb + # Weighted Linear Regression + ## Learning Objectives + ## Weighted Regression + ### Michaelis-Menten Modeling Revisited + ### Approach 1: Transformation + Linear Regression + #### Step 1: Calculate Best Fit and Plot + #### Step 2. Residual Analysis + ### Approach 2: Nonlinear Regression + ### Approach 3: Transformation + Weighted Linear Regression + #### Step 1: Calculate Best Fit and Plot + #### Step 2. Residual Analysis + ### Uncertainty Analysis + + +FILE: ./notebooks/13-publish/05-Monte-Carlo-Uncertainty-Analysis-for-Nonlinear-Regression.ipynb + # Monte Carlo Uncertainty Analysis for Nonlinear Regression + ## Simulation + ### Using Simulation to Estimate a Probability + ### Using Simulation to Estimate Means and Variances + ### Using Simulation to Determine Whether a Population is Approximately Normal + ## Monte Carlo Error Propagation + #### Student 1 + ##### Standard Error Propagation + ##### Monte Carlo Error Propagation + #### Student 2 + ##### Monte Carlo Error Propagation + ### Uncertainty Analysis for Nonlinear Regression + #### Nonlinear Regression + Linearized Uncertainty Analysis + ##### Step 1. Calculate Best Fit and Plot + ##### Step 2. Residual Analysis + ##### Step 3. Uncertainty Analysis / Calculate Covariance Matrix + #### Nonlinear Regression + Monte Carlo Uncertainty Analysis + ##### Pseudocode + ##### Python Hints + ##### Implement in Python + ##### Visualize Distribution of Fitted Parameters + ##### Compute Covariance Matrix + + +FILE: ./notebooks/13-publish/06-Bootstrap-Confidence-Intervals.ipynb + # Bootstrap Confidence Intervals + ## Bootstrap Confidence Intervals + ### Motivating Example: Catalyst Lifetime + ### Traditional Confidence Intervals + #### t-interval + ### Basic Bootstrap with Replacement + + +FILE: ./notebooks/13-publish/07-Nonlinear-Case-Study-Adsorptive-Membranes.ipynb + # Nonlinear Regression Case Study: Adsorptive Nanoporous Membranes + ## Background + ## 1. Regression Analysis + ### A. Paramter estimation using a transformation and linear regression + #### Step ii: Setup Best Fit Plot for Best Fit Model and Residuals + #### Step iii: Compute Covariance Matricies + ### B. Paramter estimation using an alternate transformation and linear regression + ### C. Parameter estimation using nonlinear regression + ### D. Comparison of Three Regression Approaches + ## 2. Estimate Batch Processing Time with Numeric Integration + ### A. Model Manipulation and Setup + ### B. Numeric Integration + ## 3. Uncertainty Propagation (Nonlinear Formula) + ### A. Define Functions + ### B. First Transformation + Linear Regression + ### C. Second (Alternate) Transformation + Linear Regression + ### D. Nonlinear Regression + ### E. Discussion + ## 4. Monte Carlo Uncertainty Propogation + ### A. Inspect Residuals + ### B. Monte Carlo Python Code + ### C. Visualize and Interpret MC Results: Fitted Parameters + ### D. Visualize and Interpret MC Results: Batch Time diff --git a/scripts/lint.py b/scripts/lint.py index 4423fb41..7a8f4522 100644 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -12,36 +12,41 @@ import nbformat URL = r'(http|ftp|https):\/\/([\w\-_]+(?:(?:\.[\w\-_]+)+))([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?' +HEADER = re.compile(r'(^|\n)(?P#{1,6})(?P
.*?)#*(\n|$)') + +def find_and_test_urls(cell): + urls = re.findall(URL, cell.source) + for protocol, domain, target in urls: + url = "://".join([protocol, "".join([domain, target])]) + try: + get = requests.get(url, timeout=10) + if not get.status_code == 200: + print(f" WARNING: {url} is not reachable, status_code: {get.status_code}") + except requests.exceptions.RequestException as e: + print(f" ERROR: {url} {e}") + + +def find_headers(cell): + headers = re.findall(HEADER, cell.source) + if headers: + print(f" {' '.join(headers[0][1:3])}") + def lint_notebook(full_folder_name, file): path = f"{full_folder_name}/{file}" - print("\n", path) + print(f"\n\nFILE: {path}") with open(path, "r") as fp: nb = nbformat.read(fp, as_version=4) - - # check that urls are reachable - print("urls ...") for cell in nb.cells: if cell.cell_type == "markdown": - urls = re.findall(URL, cell.source) - for protocol, domain, target in urls: - url = "://".join([protocol, "".join([domain, target])]) - try: - get = requests.get(url, timeout=10) - if get.status_code == 200: - print(f" OK: {url} is reachable") - else: - print(f" WARNING: {url} is not reachable, status_code: {get.status_code}") - except requests.exceptions.RequestException as e: - print(f" ERROR: {url} {e}") - + find_headers(cell) + find_and_test_urls(cell) folders = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13"] for fld in folders: full_folder_name = f"./notebooks/{fld}-publish" - print("\n", full_folder_name) for file in sorted(os.listdir(full_folder_name)): if re.match("(.*)\.ipynb$", file): lint_notebook(full_folder_name, file)