MATH52809/21/18

Mini-Lab 04

In this mini-lab, we'll investigate the method of variation of constants for solving inhomogeneous ODEs of the form (§2.10)

y''+p(x)y'+q(x)y=r(x). (1)

One of the objectives of this mini-lab is to show how combined active-reading, hand-computation, structured writing, scratch notes, and symbolic computation come together to enable deeper understanding of topics within mathematical physics.

1Method of variation of parameters

Seek solution of (1) as y(x)=yh(x)+yp(x), with yh(x) the general solution of the homogeneous ODE

y''+p(x)y'+q(x)y=0, (2)

and yp(x) a particular solution of the inhomogeneous ODE (1).

In[22]:=

rhs[y_,x_,p_,q_] := D[y,{x,2}] + p[x] D[y,x] + q[x] y;

rhsODE = rhs[u[x] Subscript[y,1][x] + v[x] Subscript[y,2][x],x,p,q]

p(x)(y1(x)u'(x)+u(x)y1'(x)+y2(x)v'(x)+v(x)y2'(x))+q(x)(u(x)y1(x)+v(x)y2(x))+y1(x)u''(x)+2u'(x)y1'(x)+u(x)y1''(x)+y2(x)v''(x)+2v'(x)y2'(x)+v(x)y2''(x)

In[24]:=

Simplify[rhsODE /. {Subscript[y,1]”[x] -> - p[x] Subscript[y,1]'[x] - q[x] Subscript[y,1][x],Subscript[y,2]”[x] -> - p[x] Subscript[y,2]'[x] - q[x] Subscript[y,2][x]}]

p(x)(y1(x)u'(x)+y2(x)v'(x))+y1(x)u''(x)+2u'(x)y1'(x)+y2(x)v''(x)+2v'(x)y2'(x)

In[18]:=

rhs[u[x] y1[x] + v[x] y2[x],x,p,q]

p(x)(u(x)y1(x)+v(x)y2(x))'(x)+q(x)(u(x)y1(x)+v(x)y2(x))(x)+(u(x)y1(x)+v(x)y2(x))''(x)

In[19]:=