PyME Preface

Preface

http://live.sympy.org/

I need to build a bookshelf. Downside, I'm an engineer. So I'm going to over engineer it. Those cheap plastic ones sag under my ME books and my wife's volumes and volumes of medical books. Right now they're on an overengineered prototype made out of 2x6s. I've done the lab tests to show a simply made I-beam can support ~200 lbs.

[The way I learned this stuff the first time was by programming it. My TI-89 was the centerpiece of my studying. Redoing junior level engineering in TI-BASIC makes you breakdown the equation into how it actually works.

For Design of Experiments class I once half wrote the most basic parts of SAS/R in TI-BASIC.]

So to self audit my Mechanics of Materials (Purdue ME323) course I decided to do what I did last time. This time with the sexyiest hammer in my toolbox.

I will assume the reader has a basic understanding of Python. If you have 13 hours, code academy is a perfect place to start.. If nothing else, you should be to download the source notebook (Upper right corner of the page).

This is where all education is going. This is why Obama is pushing for coding in school. The luddites at Slashdot think we're trying to turn everyone into programmers. We're trying to turn programmers into By 2030 "Python" will look on resumes like "keyboarding" or "Microsoft Office". Does anyone even put "keyboarding" on their keyboard anymore? At this point it's just assumed. However my wife still works with doctors that do the two finger poke because in school they were told their secretaries would handle the typing not doctors. AeroPython: https://github.com/barbagroup/AeroPython I'm not a programmer. I have no CS degree. I'm a lazy en I ended up where I am because I learned to code HyperCard on my Mac. I spent hours making animations and other 'stupid' stuff. I never showed it to anyone, it was hacky at best but it set me on a course to being an engineer and using Python/Matlab daily. I call it the "How much Calculus did Scotty learn?" conundrum. Do you think Scotty got taught calculus in college and then 350 years of scientific achievement in the next 4 years? My 9 month old found my TI-89. The one that does junior level engineering. Drone operators don't know of the [freebody dynamics or control systems that go into making them stable](http://www.mathworks.com/help/aeroblks/examples/quadcopter-project.html), they benefit because someone else figured out the hard work and automated/coded it. Mechanics of Materials should be a 3 week segment taught to 7th graders. Learn it as a practical use for vector math. Then those that want to engineer can go on to be engineers and learning something more fitting of juniors in college I'm just 10 years out and half of ME should be compressed and the last 2 years spent on what grad students were doing 10-20 years ago. Hopefully then people will understand that static and dynamic loads are different things. Even if it leads to no more Youtube videos of ropes swings that were sized staticly, (The persons weight).

[0]. Dr Stamper, one of the best professors I ever had, would sometimes spend more of class talking about not Statics than statics. Looking back, I probably learned more about working at large corporations that year than Statics. It's why vector math is important. If you can do matrix math, Statics is a sophomore highstool level math class. $\sum F=0$ $\sum M=0$

#

The quick jump from python to 3xx me courses. My TI-89 had a certain set of features, features I have grown accustomed to over a very long career. Features that would make me a nightmare for me to live without. Take my word for it that Python is heads and shoulders a more complete language than TI-BASIC. however it has a lot of things that basic Python doesn't. So as a start, lets bring Python up to (almost) what I did on the TI-89.

  1. A good set of units. Units being correct has saved my butt on tests more times than I can count. If you get a units error you likely have the wrong equation. It's also saved my butt in the real world too.

    Thankfully someone else has written a pretty good library. Pint is Python package to define, operate and manipulate physical quantities: the product of a numerical value and a unit of measurement. It allows arithmetic operations between them and conversions from and to different units. It is BSD licensed.

    [Aside: No engineering student should ever. Ever. Ever learn English units again. For the sake of my sanity and yours, I will avoid them. For the love of all that is sensible we should never crash something into another planet because we screwed up units, let alone English units.

    The output from the SM_FORCES application code as required by a MSOP Project Software Interface Specification (SIS) was to be in metric units of Newtonseconds (N-s). Instead, the data was reported in English units of pound-seconds (lbf-s). - Mars Climate Orbiter Mishap Investigation Phase I Report]

  2. You need to do matrix algebra. Matrix math with statics & dynamics makes life easy. Thankfully some smart people back in the days of Fortran wrote some: BLAS Since then we've just been adding wrappers to it. It's at the heart of pretty much any engineering program today. For Python that wrapper is NumPy. It is BSD licensed.

  3. We need a way to do symbolic math. TI-89 can do symbolic math, write the equations and forget about rearranging/transcription errors. For that there is SymPy. It is BSD licensed.

  4. We need a way to display results. For equations Jupyter notebook can handle $\LaTeX$. [If you aren't exactly sure how to draw a symbol there's always Detexify and "how do I _ in LaTeX" on google.]

    For graphs there is matplotlib. A python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. It will even let you

In [9]:
#1
import pint
#2 
import numpy
#3 Symbolic links.
import sympy
#4 Display.
from IPython.display import Latex # Display latex from Python windows.
import matplotlib                 # Plotting.
%matplotlib inline

It turns out someone else had a similar list and made a shortcut. %pylab

So for all projects we'll start with what the TI-89 can do and add packages as the course requires.

In [1]:
 
Populating the interactive namespace from numpy and matplotlib