Numerical Approximation

Download Report

Transcript Numerical Approximation

Numerical Approximation
For a spring-mass system the differential equation
of the motion is: F  ma
d 2x
 kx  m 2
dt
If you know enough calculus (or know somebody
who does) the solution is:
x  ampl sin(  t )
Where:

k
m
An Alternative to
Doing All That Calculus
1. From the mass’ current position x calculate its
acceleration: a = -(k / m) x
2. If the speed of the mass is v, calculate a new
speed at a time Dt later: vnew = v + a Dt
3. If the position of the mass is x, calculate a new
position at a time Dt later: xnew = x + vnew Dt
4. Go back to #1 and repeat
This is called Numerical Approximation (or
Numerical Integration)
About Numerical Approximation
• The solutions are only approximate
• They can be made a close to correct as we wish
by making the time step Dt small
• Some systems, particularly chaotic ones can not
be solved analytically
• For such systems, numerical approximation is
the only way that they can be solved
Numerical Approximation Module
•
We have prepared a working program that
solves the spring mass system:
1. Using numerical approximation
2. Using the solution to the differential equation
• You will “de-construct” the code to figure out
how it works
• The program is written in the Python language
using the VPython visual library