home

PDF (letter size)

Comparing solving ODE problems using Variation of parameters and Green’s function methods

Nasser M. Abbasi

December 15, 2018   Compiled on January 29, 2024 at 3:14am

Contents

1 Problem 1 (boundary value)
1.1 Variation of parameters solution
1.2 Green function solution
2 Problem 2 (boundary value)
2.1 Variation of parameters solution
2.2 Green function solution
3 Problem 3 (Initial value problem)
3.1 Variation of parameters solution
3.2 Green function solution

1 Problem 1 (boundary value)

Solve y+14y=sin2x with y(0)=0,y(π)=0

1.1 Variation of parameters solution

Solutions to y+14y=0 are y1(x)=cos(x2) and y2(x)=sin(x2). Hence Wronskian is W=|y1y2y1y2|=|cos(x2)sin(x2)12sin(x2)12cos(x2)|, therefore W=12. Hence the particular solution is yp(x)=y1(x)y2(x)f(x)Wdx+y2(x)y1(x)f(x)Wdx(1A)=2cos(x2)sin(x2)sin(2x)dx+2sin(x2)cos(x2)sin(2x)dx=2cos(x2)(13sin(3x2)15sin(5x2))+2sin(x2)(83cos2(x2)165cos2(x2))

Which is equivalent (using trig relations) to yp(x)=415sin(2x). Hence the complete solution is y(x)=C1cos(x2)+C2sin(x2)415sin(2x) Boundary condition y(0)=0 gives0=C1 Hence solution becomesy(x)=C2sin(x2)415sin(2x) Boundary condition y(π)=0 gives0=C2sin(π2)415sin(2π)=C2

Hence solution isy(x)=415sin(2x)

1.2 Green function solution

The solution y2(x)=sin(x2) satisfies the left side boundary condition y(0)=0 and the solution y1(x)=cos(x2) satisfies the right side boundary condition y(π)=0. Therefore the Green function isG(x,x0)={Asin(x2)0<x<x0Bcos(x2)x0<x<π Where A,B depend on x0 and not on x. By continuity of G over x=x0 the above givesAsin(x02)=Bcos(x02)(1)A=Bcos(x02)sin(x02)

Taking derivative of G at x=x0 givesG(x,x0)={12Acos(x02)0<x<x012Bsin(x02)x0<x<π The jump discontinuity condition gives12Bsin(x02)12Acos(x02)=1p(x) Where p(x) comes from writing the original ODE in Sturm Liouville form, which is (py)+14y=0. Therefore p=1 and the above becomes(2)12Bsin(x02)12Acos(x02)=1 Substituting (1) into (2) gives12Bsin(x02)12(Bcos(x02)sin(x02))cos(x02)=112Bsin(x02)sin(x02)12(Bcos(x02))cos(x02)=sin(x02)B2(sin(x02)sin(x02)+cos(x02)cos(x02))=sin(x02)B2(sin2(x02)+cos2(x02))=sin(x02)B=2sin(x02)

Hence A=2sin(x02)cos(x02)sin(x02)=2cos(x02)

Therefore Green function becomesG(x,x0)=2{cos(x02)sin(x2)0<x<x0sin(x02)cos(x2)x0<x<π Here comes an important step, we now flip the x,x0 above to beG(x0,x)=2{cos(x2)sin(x02)0<x0<xsin(x2)cos(x02)x<x0<π We need to do this, since integration below over x0 and we would like the answer to be as function of x and not x0. Hence the solution isy(x)=0πG(x0,x)f(x0)dx0=0xG(x0,x)f(x0)dx0+xπG(x0,x)f(x0)dx0=20xcos(x2)sin(x02)sin(2x0)dx02xπsin(x2)cos(x02)sin(2x0)dx0=2cos(x2)0xsin(x02)sin(2x0)dx02sin(x2)xπcos(x02)sin(2x0)dx0=815cos(x)sin(x)=415sin(2x)

Which is the same as Variation of parameters solution.

2 Problem 2 (boundary value)

This is the same as the above problem, but with different forcing function. Solve y+14y=x2 with y(0)=0,y(π)=0

2.1 Variation of parameters solution

Solutions to y+14y=0 are y1(x)=cos(x2) and y2(x)=sin(x2). Hence Wronskian is W=|y1y2y1y2|=|cos(x2)sin(x2)12sin(x2)12cos(x2)|, therefore W=12. Hence the particular solution is yp(x)=y1(x)y2(x)f(x)Wdx+y2(x)y1(x)f(x)Wdx(1A)=2cos(x2)sin(x2)x2dx+2sin(x2)cos(x2)x2dx=2x

Hence the complete solution is y(x)=C1cos(x2)+C2sin(x2)+2x Boundary condition y(0)=0 gives0=C1 Hence solution becomesy(x)=C2sin(x2)+2x Boundary condition y(π)=0 gives0=C2sin(π2)+2π2π=C2

Hence solution isy(x)=2πsin(x2)+2x

2.2 Green function solution

We already found the Green function for the operator y+14y=0 with same boundary conditions. So we only need to do the convolution integral now. This is the advantage of using Green function. Once we find it for same operator with same BC, we can use it to find solution when the forcing function changes, by just doing the final convolution integration. The hard work of finding Green function only needs to be done once.

UsingG(x0,x)=2{cos(x2)sin(x02)0<x0<xsin(x2)cos(x02)x<x0<π Hence the solution isy(x)=0πG(x0,x)f(x0)dx0=0xG(x0,x)f(x0)dx0+xπG(x,x0)f(x0)dx0=20xcos(x2)sin(x02)x02dx02xπsin(x2)cos(x02)x02dx0=2cos(x2)0xsin(x02)x02dx02sin(x2)xπcos(x02)x02dx0=2πsin(x2)+2x

Which is the same as Variation of parameters solution.

3 Problem 3 (Initial value problem)

Green’s function can also be used to solve initial value problem. Solve y+ω2y=sin(t) with y(0)=0,y(0)=0.

3.1 Variation of parameters solution

Solutions to y(t)+ω2y(t)=0 are y1(x)=cos(ωt) and y2(x)=sin(ωt). Hence Wronskian is W=|y1y2y1y2|=|cos(ωt)sin(ωt)ωsin(ωt)ωcos(ωt)|, therefore W=ω. Hence the particular solution is yp(t)=y1(t)y2(t)f(t)Wdt+y2(t)y1(t)f(t)Wdt(1A)=cos(ωt)ωsin(ωt)sin(t)dt+sin(ωt)ωcos(ωt)sin(t)dt=sin(t)ω21

Hence the complete solution is y(t)=C1cos(ωt)+C2sin(ωt)+sin(t)ω21 Boundary condition y(0)=0 gives0=C1 Hence solution becomesy(t)=C2sin(ωt)+sin(t)ω21y(t)=ωC2cos(ωt)+cos(t)ω21

Boundary condition y(t)=0 gives0=ωC2+1ω211ω(1ω2)=C2

Hence solution isy(t)=1ω(1ω2)sin(ωt)+sin(t)ω21

3.2 Green function solution

The main difference between initial value and boundary value for using Green function, is that in boundary value, we set it up as

G(t,t0)={C1y1(t)0<t<t0C2y2(t)t0<t< Where y1(t),y2(t) are the corresponding basis for the solutions of homogeneous ODE y(t)+=0. Since this ODE will have 2 solution basis, we select the one which satisfies the left boundary and call it y1(t) and select the one which satisfies the right boundary and call it y2(t) and now we only have to find C1,C2 which depends on t0 by using continuity and jump discontinuity condition on G.

In initial value problem, we can’t do this, since all conditions are on one end. Instead We write the Green function asG(t,t0)={C1y1(t)+C2y2(t)0<t<t0C3y1(t)+C4y2(t)t0<t< And then find C1,C2 both from the initial conditions. If initial conditions are homogeneous, like this in problem, then we will find that C1=0 and also C2=0 as expected. And we end up with Green function that looks likeG(t,t0)={00<t<t0C3y1(t)+C4y2(t)t0<t< Where we now solve for C3,C4 which depends on t0 by using continuity and jump discontinuity condition on G as before. The above will result if the the initial conditions are zero as in this case. So we start from the above form and now find C3,C4.

Since y1(t)=cos(ωt),y2(t)=sin(ωt), then G becomes(1A)G(t,t0)={00<t<t0C3cos(ωt)+C4sin(ωt)t0<t< continuity conditions on G gives(1)C3cos(ωt0)+C4sin(ωt0)=0 Taking derivative at t=t0 givesG(t,t0)={00<t<t0ωC3sin(ωt)+ωC4cos(ωt)t0<t< Jump discontinuity gives(2)ωC3sin(ωt0)+ωC4cos(ωt0)=1p(t0)=1 Since p(t0)=1 by looking at the ODE. Solving (1,2) for C3,C4. From (1)C3=C4sin(ωt0)cos(ωt0) From (2)ω(C4sin(ωt0)cos(ωt0))sin(ωt0)+ωC4cos(ωt0)=1ωC4(sin(ωt)cos(ωt0)sin(ωt0)+cos(ωt0))=1ωC4(sin(ωt0)sin(ωt0)+cos(ωt0)cos(ωt0))=cos(ωt0)ωC4=cos(ωt0)C4=cos(ωt0)ω

Hence C3 becomesC3=(cos(ωt0)ω)sin(ωt0)cos(ωt0)=sin(ωt0)ω

Therefore (1A) becomesG(t,t0)={00<t<t0sin(ωt0)ωcos(ωt)+cos(ωt0)ωsin(ωt)t0<t<=1ω{00<t<t0sin(ωt0)cos(ωt)+cos(ωt0)sin(ωt)t0<t<

Using sinAcosBcosAsinB=sin(AB) the above becomes, using sin(ωt)cos(ωt0)cos(ωt)sin(ωt0), where A=ωt,B=ωt0 G(t,t0)=1ω{00<t<t0sin(ω(tt0))t0<t< So, we finally found the Green function. The solution is now found using convolution y(t)=0tG(t,t0)f(t0)dt0=1ω0tsin(ω(tt0))sin(t0)dt0=1ω(1ω2)sin(ωt)+sin(t)ω21

Which is the same answer using variation of parameters.

To add more problems...