Game Development Reference
In-Depth Information
dy
(
)
(
)
(
)
.
(16.70)
fxy
,
=
fxy
,
+
fxy
,
x
y
dx
(
)
Since
dy dx
=
f
x y
,
, this becomes
(
)
(
)
(
)
(
)
f
xy
,
=
f xy
,
+
f xy
,
f xy
,
.
(16.71)
x
y
(
)
Higher derivatives of
f xy quickly become very messy, but we could theoreti-
cally compute them to construct the k -th order Taylor series approximation. The
function f may have a form that enables easy calculation of its derivatives.
,
16.4.3 Runge-Kutta Method
Because of the necessity of calculating derivatives, the Taylor series method is
not commonly used. Everything that we have examined so far in this section has
served as a prelude to our discussion of the Runge-Kutta method , a reliable and
accurate technique for numerically solving most differential equations that arise
in physical simulations appearing in a 3D graphics application.
The Runge-Kutta method determines how to step from y to
y + by choosing
1
(
)
the function F in Equation (16.64) to be one that evaluates
f xy at multiple
points and takes a weighted average to approximate the derivative of y . In gen-
eral, the function F has the form
,
m
(
)
(
)
F
xy
,
=
wfuv
,
,
(16.72)
i
i
j
j
j
j
=
1
(
)
(
)
where m is the number of points at which
xy is evaluated, each point
,
uv
,
f
j
j
(
)
lies near the point
x y , and w is the weight associated with the j -th point. The
points and weights are chosen so that
,
i
i
(
)
xy matches a k -th order Taylor series
,
F
i
i
(
)
function
T xy given by Equation (16.69). This is accomplished without hav-
ing to evaluate derivatives of f .
The value of m is called the number of stages of the method. We first consid-
er a two-stage Runge-Kutta method in which the function F has the form
,
k
i
i
(
)
(
)
(
(
)
)
xy
,
=
wfxy
,
+
wfx ahy ahfxy
+
,
+
,
.
(16.73)
F
i
i
1
i
i
2
i
i
i
i
We would like to choose
w ,
w , and a so that this function matches the second-
(
)
order Taylor series function
xy as closely as possible. To achieve this
,
T
2
i
i
(
(
)
)
goal, we expand
x hy f
+
,
+
xy
,
in a Taylor series as follows.
f
i
i
i
i