Chapter 5 - 5.2 - 15

file:bd5-2p15.mws

>    restart;

Define the differential equation

>    ode := diff(y(x),x,x) - x*diff(y(x),x) -y(x) =0;

ode := diff(y(x),`$`(x,2))-x*diff(y(x),x)-y(x) = 0

Define the initial conditions - notice the special form for y'(0)

>    ics := y(0)=2, D(y)(0)=1;

ics := y(0) = 2, D(y)(0) = 1

Use the Maple command dsolve with the series option to construct a power series about x=0

>    dsolve({ode,ics},y(x),series);

y(x) = series(2+1*x+1*x^2+1/3*x^3+1/4*x^4+1/15*x^5+O(x^6),x,6)

I copied 4 terms and defined y4

>    y4 := 2+1*x+1*x^2+1/3*x^3;

y4 := 2+x+x^2+1/3*x^3

>    y5 := 2+1*x+1*x^2+1/3*x^3+x^4/4;

y5 := 2+x+x^2+1/3*x^3+1/4*x^4

Graph of y4 and y5 - which is red?

>    plot({y4,y5},x=0..5);

[Maple Plot]

Construct the exact solution - this may or may not work

>    dsolve({ode,ics},y(x));

y(x) = 1/2*erf(1/2*2^(1/2)*x)*exp(1/2*x^2)*Pi^(1/2)*2^(1/2)+2*exp(1/2*x^2)

>    soln := rhs(%);

soln := 1/2*erf(1/2*2^(1/2)*x)*exp(1/2*x^2)*Pi^(1/2)*2^(1/2)+2*exp(1/2*x^2)

Compute the power series of exact solution up to order x^5

>    series(soln,x=0,5);

series(2+1*x+1*x^2+1/3*x^3+1/4*x^4+O(x^5),x,5)

>    plot({y4,y5,soln},x=0..1);

[Maple Plot]  

>