
A much more accurate, and more widely used, method of approximation is the Runge-Kutta method. It uses a sampling of slopes through an interval and takes a weighted average to determine the right end point. This averaging gives a very accurate approximation as will be shown in the examples that follow.
The basic formula is stated without proof below. It has as its basis, Simpson's Formula and the fundamental theorem of calculus. Refer to the graphic below for the following analysis.
Given an initial value (
) you want to
compute
. By the fundamental
theorem:

Using Simpson's Formula:
Because you want to approximate the slope y'(x+1/2h) at the
midpoint, the middle term above is split into two terms. You want
to define
so that:
On the RHS, the true slopes are replaced with the following estimates:

Substituting these into the previous equation gives the formula:

This formula is called the 4th Order Runge-Kutta method and LiveMath's numerical differential equation solver uses it. Before this feature of the program is demonstrated, the following example will use the formula just derived.
The formula used in the last example is an iterative one and
therefore to calculate subsequent points, the
value
becomes the new y. Although LiveMath does not have a programming
language that will allow you to do this automatically, you can
create a notebook which will allow you to manually calculate points
by using a temporary variable to hold each new y. With Always
ReCompute turned on, you can also copy each point and paste the
value back into the original y located at the beginning of the
notebook. Keep in mind that this will not be very accurate because
of round-off errors.
For the final example, use the same equation and graph the Runge-Kutta, Euler and actual solution curves together.
Expl #22 Runge-Kutta: How Accurate?
To better show the differences, the graph bounds are adjusted to show the curves at x=1. Although not evident from the graph above, you know from the process of plotting these lines, that the Runge-Kutta is so accurate that it appears to be right on top of the actual solution curve. By zooming in on these two lines, you should be able to generate a graph showing an error. This will require quite a few zooms.