Ordinary Differential Equations
Used anytime you need to find out how something changes with time (and sometimes space). Differential Equations*: an equation involving the derivative or differentials of the dependent variable Order of a differential equation: the order of the highest derivative in the equation.
Examples
Newton's Law of Cooling Models how temperature changes as it loses heat. "The rate of change in the temperature of an object is proportional to the difference in temperature between the object and room temperature."
ODE : Solve ODE:
Swinging of the pendulum Newton's second law for a rotating object can model how the moment of inertia times angular acceleration is equal to the net exteernal torque.
However, that equation is very difficult to solve.
Numerical Solutions
Numerical methods are used to obtain a graph or table of the unknown function.
- Most methods used to solve ODE are based on truncated Taylor series expansions.
Taylor Series Method
A first order ODE: ,
Solve by estimating the solution at dfferent base points , , , ... are trunctaed using gtruncated taylor series expansions.
Trunctaed taylor series expansion:
- The nth order Taylor series method uses nth ordertruncated taylor series expansion
First order taylor series method (euler method)
Notation: , Euler Method::
You will be given a problem with the following information: first order ODE: initial condition: determine: for
Tangent Line Approximation You can approximate a solution to by using the tangent like to find out how much the y value differs from the initial t value.
- If is close enough to , then the approximation is good.
- You can find point using the slope at point .
- Then you plot the points found from each segment and connect with line segments.
, where
The error can be found: Percent Relative Error
Heun's Method
A fundamental souorce of error in Eurler's method is that the derivative at the beginingg of the itnerval iss assumed to apply across the entire interval.
The Heun's Method improves the estimate of the slope by determining two derivatives for the interval: initial and end poinnt. Two derivatives are then averaged to obtain an improved estimate of the slope for the entire interval.
Midpoint Method
Also called Improved Polygonmethod. It uses Euler's method to predict a value of y at the midpoint of the inerval.
Runge-Kutt Methods (RK)
Achiev the accuracy of a Taylor series approach without requiring the calculation of higher derivatives.
Matlab
Mathlab recommends ode45 as the first solver for a problem
- ode45 uses fourth and fifth order Runge-Kuttal formula (Dormand-Prince).
- create a m-file fo the dy/dx function (for example, firstode.m)
[x,y]=ode(@firstode,[1,2],-4)- Matlab returns two column vectors, the first with values of x an the second with values of y.
- Plot with
plot(x,y)
Linked from Computational Modeling