Physics and Numerical Calculations
Rhett Allain
Introduction
Let’s get started
A physics problem
Use the definition of average velocity
Breaking into pieces
Fill in the table for v = 0.45 m/s
Time (s) | dt (s) | x (m) |
0 | 0.25 | 0 |
| | |
| | |
| | |
| | |
| | |
| | |
Fill in the table for v = 0.45 m/s
Time (s) | dt (s) | x (m) |
0 | 0.25 | 0 |
0.25 | 0.25 | 0.1125 |
| | |
| | |
| | |
| | |
| | |
Fill in the table for v = 0.45 m/s
Time (s) | dt (s) | x (m) |
0 | 0.25 | 0 |
0.25 | 0.25 | 0.1125 |
0.5 | 0.25 | 0.225 |
0.75 | 0.25 | 0.3375 |
1 | 0.25 | 0.45 |
1.25 | 0.25 | 0.5625 |
1.5 | 0.25 | 0.675 |
Same final position
You are a computer
Making a numerical model
Position Update Formula
First Program
*No Units!
In one-window, there will be a pencil for edit
This is the same as line 7
Notes
Your Turn
http://bit.ly/trinket-physics
(Click “using small pieces”)
Accelerating cart
Solution
Some derivations skipped
Break it into small steps
Fill in the table for v = 0.45 m/s and a = 0.2 m/s^2
Time (s) | dt (s) | v (m/s) | x (m) |
0 | 0.25 | 0.45 | 0 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
Fill in the table for v = 0.45 m/s and a = 0.2 m/s^2
Time (s) | dt (s) | v (m/s) | x (m) |
0 | 0.25 | 0.45 | 0 |
0.25 | 0.25 | 0.5 | 0.125 |
| | | |
| | | |
| | | |
| | | |
| | | |
Technically
Wrong
Not Average
Velocity - but close
Fill in the table for v = 0.45 m/s and a = 0.2 m/s^2
Time (s) | dt (s) | v (m/s) | x (m) |
0 | 0.25 | 0.45 | 0 |
0.25 | 0.25 | 0.5 | 0.125 |
0.5 | 0.25 | 0.55 | 0.2625 |
0.75 | 0.25 | 0.6 | 0.4125 |
1 | 0.25 | 0.65 | 0.575 |
1.25 | 0.25 | 0.7 | 0.75 |
1.5 | 0.25 | 0.75 | 0.9375 |
Close to 0.9
Second program
Your turn
How to get more data
Indented print
Prints stuff in each loop run
Comments
Graphs
Creates axes
Creates curve
Adds data to
graph
Your Turn
A real physics problem
Starter Program
These are incomplete
Notes
Throw a Ball
h
Physics Stuff
*note: in 1-dimension
Starter Program
Calculate the force
in the loop
Calculate the
acceleration
Velocity update
Position update
You fill these in
Results
Highest Point
Getting Back to the ground
Adding a Graph
Output
Your Turn