Skip to content
No description, website, or topics provided.
Jupyter Notebook
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Computational Mechanics 02 - Analyze Data

Learning some statistics and data processing skills in Python

Welcome to Computational Mechanics Module #2 - Analyze Data

There are four modules and one final project. The modules will get us started on our exploration of computational mechanics using Python, listed below each module are the learning objectives.

  1. 01_Cheers_Stats_Beers
  • Read data from a csv file using pandas.
  • The concepts of Data Frame and Series in pandas.
  • Clean null (NaN) values from a Series using pandas.
  • Convert a pandas Series into a numpy array.
  • Compute maximum and minimum, and range.
  • Revise concept of mean value.
  • Compute the variance and standard deviation.
  • Use the mean and standard deviation to understand how the data is distributed
  • Plot frequency distribution diagrams (histograms).
  • Normal distribution and 3-sigma rule.
  1. 02_Seeing_Stats
  • You should always plot your data.
  • The concepts of quantitative and categorical data.
  • Plotting histograms directly on columns of dataframes, using pandas.
  • Computing variance and standard deviation using NumPy built-in functions.
  • The concept of median, and how to compute it with NumPy.
  • Making box plots using pyplot.
  • Five statistics of a box plot: the quartiles Q1, Q2 (median) and Q3 (and
  • interquartile range Q3$-$Q1), upper and lower extremes.
  • Visualizing categorical data with bar plots.
  • Visualizing multiple data with scatter plots and bubble charts.
  • pandas is awesome!
  1. 03_Linear_Regression_with_Real_Data
  • Making our plots more beautiful
  • Defining and calling custom Python functions
  • Applying linear regression to data
  • NumPy built-ins for linear regression
  • The Earth is warming up!!!
  1. 04_Stats_and_Montecarlo
  • How to generate "random" numbers in Python+
  • The definition of a Monte Carlo model
  • How to calculate $\pi$ with Monte Carlo
  • How to take the integral of a function with Monte Carlo
  • How to propagate uncertainty in a model with Monte Carlo
  • Bonus: use Sympy to do calculus and algebra for us! _no need for
  • Wolfram, sorry Stephen_
  • How to generate a normal distribution using uniformly random numbers

+The computer only generates pseudo-random numbers. For further information and truly random numbers check

Computational Mechanics Project #02 - Create specifications for a spitballing robot

On the first day of class, we threw $2"\times~2"$ dampened paper (spitballs) at a target on the whiteboard. Now, we are going to analyze the accuracy of the class with some cool Python tools and design a robot that has the same accuracy and precision as the class.

The goal of this project is to determine the precision of necessary components for a robot that can reproduce the class throwing distibution. We have generated pseudo random numbers using numpy.random, but the class target practice is an example of truly random distributions. If we repeated the exercise, there is a vanishingly small probability that we would hit the same points on the target, and there are no deterministic models that could take into account all of the factors that affected each hit on the board.

You can’t perform that action at this time.