Example 3.5 

The method described for example 3.4 can beused to solve boundary value problems.  Consider the boundary value problem given by the Airy differential equation: 

 

Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mo( 

                                                                                                        (3.16) 

Typesetting:-mrow(Typesetting:-mi( 

 

The procedure for solving this boundary value problem is the same as that of section 3.1.2 except that instead of the exponential matrix, the matrizant must be used. 

> restart:
 

> with(linalg):with(plots):
 

Warning, the protected names norm and trace have been redefined and unprotected
 

Warning, the name changecoords has been redefined
 

> N:=2;
 

`:=`(N, 2) (1)
 

> nvars:=6;
 

`:=`(nvars, 6) (2)
 

> Eq:=diff(y(x),x$2)=x*y(x);
 

`:=`(Eq, diff(y(x), `$`(x, 2)) = `*`(x, `*`(y(x)))) (3)
 

> A:=matrix(2,2,[0,1,x,0]);
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi( (4)
 

> Y0:=matrix(N,1,[1,c[1]]);
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi( (5)
 

> id:=Matrix(N,N,shape=identity);
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi( (6)
 

> X1:=matrix(N,N);X2:=matrix(N,N);
 

`:=`(X1, array(1 .. 2, 1 .. 2, [])) (7)
 

`:=`(X2, array(1 .. 2, 1 .. 2, [])) (7)
 

> X1:=map(int,subs(x=x1,evalm(A)),x1=0..x);
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi( (8)
 

> mat := evalm(id + X1) ;
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi( (9)
 

> for i from 2 to nvars do
S:=evalm( subs(x=x1,evalm(A))&*subs(x=x1,evalm(X1)) ):X2:=
map(int,S,x1=0..x):mat := evalm(mat +X2) :
X1:=evalm(X2):od :
 

> evalm(mat) ;
 

Typesetting:-mrow(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mn( (10)
 

> sol:=evalm(mat&*Y0);
 

Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi( (11)
 

> y:=sol[1,1];
 

`:=`(y, `+`(1, `*`(`/`(1, 6), `*`(`^`(x, 3))), `*`(`/`(1, 180), `*`(`^`(x, 6))), `*`(`/`(1, 12960), `*`(`^`(x, 9))), `*`(`+`(x, `*`(`/`(1, 12), `*`(`^`(x, 4))), `*`(`/`(1, 504), `*`(`^`(x, 7)))), `*`(... (12)
 

> dydx:=sol[2,1];
 

`:=`(dydx, `+`(`*`(`/`(1, 2), `*`(`^`(x, 2))), `*`(`/`(1, 30), `*`(`^`(x, 5))), `*`(`/`(1, 1440), `*`(`^`(x, 8))), `*`(`+`(1, `*`(`/`(1, 3), `*`(`^`(x, 3))), `*`(`/`(1, 72), `*`(`^`(x, 6))), `*`(`/`(1... (13)
 

Now the unknown constant c1 is solved by using the boundary condition at x = 1. 

> bc2:=subs(x=1,dydx)=0;
 

`:=`(bc2, `+`(`/`(769, 1440), `*`(`/`(764, 567), `*`(c[1]))) = 0) (14)
 

> c[1]:=solve(bc2,c[1]);
 

`:=`(c[1], -`/`(48447, 122240)) (15)
 

> y:=eval(y);
 

`:=`(y, `+`(1, `*`(`/`(1, 6), `*`(`^`(x, 3))), `*`(`/`(1, 180), `*`(`^`(x, 6))), `*`(`/`(1, 12960), `*`(`^`(x, 9))), `-`(`*`(`/`(48447, 122240), `*`(x))), `-`(`*`(`/`(16149, 488960), `*`(`*`(`^`(x, 4)... (16)
 

Readers can verify this series solution with the series solution obtained by using Maple's 'dsolve' command.