Game Development Reference
In-Depth Information
16.4.2 Taylor Series Method
Any method for approximating the solution to a differential equation by taking
one step at a time assumes the form
(
)
(
)
(
)
y xh yx Fxy
+=
+
,
,
(16.64)
i
i
i
i
where the function F is some function that produces an approximation to the de-
rivative of y over the interval
]
. For Euler's method, the function F is
simply the function f . To find a function F that achieves greater accuracy than
that provided by Euler's method, we consider the Taylor series (see Appendix D)
of
,
xh
+
[
x
i
i
(
)
y xh
+
:
i
2
3
h
h
()
(
) ()
()
′′
()
3
()
y xh yx yx
+=
+
+
yx
+
y x
+
.
(16.65)
i
i
i
i
i
2!
3!
For a differential equation written in the form of Equation (16.58), the derivatives
of
()
y x can all be calculated using the relationship
()
n
()
(
n
1
)
(
)
y
xf
=
xy
,
.
(16.66)
By taking
1
derivatives, we can calculate the Taylor series approximation of
k
(
)
y xh
+
to k -th order in the step size h , yielding
i
h
2
h
k
(
)
(
)
(
)
(
)
(
)
y xh y f
+≈+
xy
,
+
f
xy
,
++
f
k
1
xy
,
,
(16.67)
i
i
i
i
i
i
i
i
2!
k
!
()
where
, this reduces to Euler's method. Writing Equation
(16.67) in the form of Equation (16.64), we have
y
=
yx
. When
=
1
k
i
i
(
)
(
)
(
)
y xh yx Txy
+=
+
,
,
(16.68)
i
i
k
i
i
(
)
where
xy is defined as
,
T
k
i
i
2
k
1
h
h
(
)
(
)
(
)
(
k
1
)
(
)
T
xy
,
=
fxy
,
+
f xy
,
+
+
f
xy
,
. (16.69)
k
i
i
i
i
i
i
i
i
2!
k
!
This is known as the k-th order Taylor series method .
Since y is a function of x , we must be careful to evaluate the total derivatives
(
)
of
xy in the Taylor series. The first derivative is
,
f