Page 3 - DOC-20220324-WA0012.-488-500
P. 3
11.1 Methods for First-Order Systems 467
A program to proceed from x(t) to x(t + h) and from y(t) to y(t + h) is easily written by
using a few terms of the Taylor series:
h 2 h 3 h 4
(4)
x(t + h) = x + hx + x + x + x + ···
2 6 24
h 2 h 3 h 4
(4)
y(t + h) = y + hy + y + y + y + ···
2 6 24
together with equations for the various derivatives. Here, x and y and all their derivatives
are functions of t; that is, x = x(t), y = y(t), x = x (t), y = y (t), and so on.
A pseudocode program that generates and prints a numerical solution from 0 to 1 in
4
100 steps is as follows. Terms up to h have been used in the Taylor series.
program Taylor System1
(4)
integer k; real h, t, x, y, x , y , x , y , x , y , x , y (4)
integer nsteps ← 100; real a ← 0, b ← 1
x ← 1; y ← 0; t ← a
output 0, t, x, y
h ← (b − a)/nsteps
for k = 1 to nsteps do
x ← x − y + t(2 − t(1 + t))
2
y ← x + y + t (−4 + t)
x ← x − y + 2 − t(2 + 3t)
y ← x + y + t(−8 + 3t)
x ← x − y − 2 − 6t
y ← x + y − 8 + 6t
x (4) ← x − y − 6
y (4) ← x + y + 6
1 1 1
x ← x + h x + h x + h x + h x (4)
2 3 4
1 1 1
y ← y + h y + h y + h y + h y (4)
2 3 4
t ← t + h
output k, t, x, y
end for
end program Taylor System1
Vector Notation
Observe that System (1) can be written in vector notation as
2 3
x x − y + 2t − t − t
= 2 3 (3)
y x + y − 4t + t
with initial conditions
x(0) 1
=
y(0) 0
This is a special case of a more general problem that can be written as
X = F(t, X)
(4)
X(a) = S, given