In the previous chapter we solved for the landing spot of
a projectile by finding the root of the parabolic function derived from
the equation of motion of an object in a constant gravitational field.
But what if we include other effects? Air resistance, for
example, adds a velocity dependent term to the ODE. In such cases, there
may not exist nice analytical formulas on which we can run our root finding
algorithms. In such cases we typically will solve the equation numerically
with a method such as the Euler
or Predictor-Correction methods
discussed in Chapter 2 : Physics.
However, those methods do not provide very reliable, quick
answers. In this chapter we look at some improved ODE solving methods.
These include the
- Midpoint or 2nd order Runge-Kutta method
- this method obtains a better estimate for the increment in the function
by using the slope at the center of the interval. Demo
- 4th order Runge-Kutta method - this
workhorse method provides a somewhat better estimate of the function
increment than the 2nd order version by using a weighted average of
four slopes from the sides and midpoint of the the interval. Demo
In Chapter 2: Physics we examined
initial value problems. Here we discuss Boundary
Value Problems and the Shooting Method
for solving such problems.