LODE2ndOrder.mws

2nd order linear ODE with constant coefficients      MapleFiles/ET502/ LODE2ndOrder.mws   example

>    restart;

>    with(linalg):

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

coefficients:

>    a0:=1;a1:=3;a2:=2;

a0 := 1

a1 := 3

a2 := 2

>    f:=exp(2*x);

f := exp(2*x)

auxilary equation:

>    ax:=a0*m^2+a1*m+a2;

ax := m^2+3*m+2

>    solve(ax=0,m);

-1, -2

fundamental set:

>    y1:=exp(-x);

y1 := exp(-x)

>    y2:=exp(-2*x);

y2 := exp(-2*x)

Wronskians:

>    A:=matrix(2,2,[y1,y2,diff(y1,x),diff(y2,x)]);

A := matrix([[exp(-x), exp(-2*x)], [-exp(-x), -2*exp(-2*x)]])

>    W:=simplify(det(A));

W := -exp(-3*x)

Variation of parameter:

>    VP1:=simplify(-y2/W*f/a0);

VP1 := exp(3*x)

>    VP2:=simplify(y1/W*f/a0);

VP2 := -exp(4*x)

>    u1:=simplify(int(VP1,x));

u1 := 1/3*exp(3*x)

>    u2:=simplify(int(VP2,x));

u2 := -1/4*exp(4*x)

complimentary solution:

>    yc:=c[1]*y1+c[2]*y2;

yc := c[1]*exp(-x)+c[2]*exp(-2*x)

particular solution of non-homogeneous equation:

>    yp:=u1*y1+u2*y2;

yp := 1/3*exp(3*x)*exp(-x)-1/4*exp(4*x)*exp(-2*x)

>    yp:=simplify(yp);

yp := 1/12*exp(2*x)

General solution of non-homogeneous equation:

>    y:=yc+yp;

y := c[1]*exp(-x)+c[2]*exp(-2*x)+1/12*exp(2*x)

Solution curves of homogeneous equation:

>    p:={seq(seq(i*exp(-x)+j*exp(-2*x),i=-2..2),j=-2..2)}:

>    plot(p,x=-1.5..0.5,color=black);

[Maple Plot]

>