Page 4 - DOC-20220324-WA0012.-488-500
P. 4
468 Chapter 11 Systems of Ordinary Differential Equations
where
x x
X = X =
y y
and F is the vector whose two components are given by the right-hand sides in Equation (1).
Since F depends on t and X, we write F(t, X).
Systems of ODEs
We can continue this idea in order to handle a system of n first-order differential equations.
First, we write them as
⎧
x = f 1 (t, x 1 , x 2 ,..., x n )
⎪ 1
⎪
⎪
⎪ x = f 2 (t, x 1 , x 2 ,..., x n )
⎪
⎪ 2
⎨
.
.
⎪ .
⎪
⎪ x = f n (t, x 1 , x 2 ,..., x n )
⎪
⎪ n
⎪
⎩
x 1 (a) = s 1 , x 2 (a) = s 2 ,..., x n (a) = s n all given
Then we let
⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤
x 1 x f 1 s 1
1
x s
⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢ x 2 ⎥ ⎢ 2 ⎥ ⎢ f 2 ⎥ ⎢ 2 ⎥
X = ⎢ . ⎥ X = ⎢ . ⎥ F = ⎢ . ⎥ S = ⎢ . ⎥
. . . .
⎣ . ⎦ ⎣ . ⎦ ⎣ . ⎦ ⎣ . ⎦
x
x n f n s n
n
and we obtain Equation (4), which is an ordinary differential equation written in vector
notation.
Taylor Series Method: Vector Notation
The m-order Taylor series method would be written as
h 2 h m
(m)
X(t + h) = X + hX + X + ··· + X (5)
2 m!
where X = X(t), X = X (t), X = X (t), and so on.
A pseudocode for the Taylor series method of order 4 applied to the preceding problem
can be easily rewritten by a simple change of variables and the introduction of an array and
an inner loop.
program Taylor System2
integer i, k; real h, t; real array (x i ) 1:n ,(d ij ) 1:n×1:4
integer n ← 2, nsteps ← 100
real a ← 0, b ← 1
t ← 0; (x i ) ← (1, 0)
output 0, t,(x i )
h ← (b − a)/nsteps