You are on page 1of 7

PRACTICAL - 4

Solution of differential
equation by Variation
of parameter method.
Question 1 : Solve second order differential equation (d ^ 2 y ) / dx^ 2 + 9 y = sec (3 x ) by
variation of parameter method
Solution :
2 Anubhav practical 4.nb

In[13]:= Sol = DSolve[y''[x] + 9 y[x] 0, y[x], x]


sol1 = Evaluate[y[x] /. Sol[[1]] /. {C[1] c
1, C[2]
sol2 c 0}]
= y[x] /. Sol[[1]] /. {C[1] c 0, C[2] c 1}
fs = {sol1, sol2}
wm = {fs, D[fs, x]}
wm // MatrixForm
wd = Simplify[Det[wm]]
u1 = (Integrate[- sol2 Sec[3 x], x]) / wd
u2 = (Integrate[sol1 Sec[3 x], x]) / wd
yc = DSolve[y''[x] + 9 y[x] 0, y[x], x]
yp = Evaluate [y [x ] / . Sol [[ 1]] / . { C[ 1] c u1, C [2] c u2 }]
yg = yc + yp
Out[13]= y x c C 1 Cos 3 x + C 2 Sin 3 x

Out[14]= Cos 3 x

Out[15]= Sin 3 x

Out[16]= Cos 3 x , Sin 3 x

Out[17]= Cos 3 x , Sin 3 x , – 3 Sin 3 x , 3 Cos 3 x


Out[18]//MatrixForm=
Cos [3 x ] Sin [3 x ]
( )
– 3 Sin 3 x 3 Cos 3 x

Out[19]= 3

1
Out[20]= Log [Cos [3 x ]]
9
x
Out[21]=
3
Out[22]= y x c C 1 Cos 3 x + C 2 Sin 3 x

1 1
Out[23]= Cos[3 x] Log[Cos[3 x]] + x Sin[3 x]
9 3
1 1
Out[24]= {{ Cos[3 x] Log[Cos[3 x]] + (y[x] c C[1] Cos[3 x] + C[2] Sin[3 x]) + x Sin[3 x]}}
9 3

Question 2 : Solve third order differential equation (d ^ 3 y) / dx^ 3 + 4 dy / dx =


sec (2 x) by variation of parameter method
Solution :
Anubhav practical 4.nb 3

In[25]:= Sol = DSolve[y'''[x] + 4 y'[x] 0, y[x], x]


sol1 = Evaluate[y[x] /. Sol[[1]] /. {C[1] c 2, C[2] c 0, C[3] c 0}]
sol2 = Evaluate[y[x] /. Sol[[1]] /. {C[1] c
0, C[2]
sol3 c - 2, C[3] c 0}]
= Evaluate[y[x] /. Sol[[1]] /. {C[1] c 0, C[2] c 0, C[3] c 1}]
fs = {sol1, sol2, sol3}
wm = {fs, D[fs, x], D[fs, {x, 2}]}
MatrixForm[wm]
wd = Simplify[Det[wm]]
a = (1 / wd Det[{{0, sol2, sol3}, {0, D[sol2, x], D[sol3, x]},
{ Sec[2 x], D[sol2, {x, 2}], D[sol3, {x,
2}]}}]) //x]Simplify
u1 = Integrate[a,
b = (1 / wd Det[{{sol1, 0, sol3}, {D[sol1, x], 0, D[sol3, x]},
{ D[sol1, {x, 2}], Sec[2 x], D[sol3, {x,
2}]}}]) //x]Simplify
u2 = Integrate[b,
c = (1 / wd Det[{{sol1, sol2, 0}, {D[sol1, x], D[sol2, x], 0},
{ D[sol1, {x, 2}], D[sol2, {x, 2}], Sec[2
x]}}]) // x]
u3 = Integrate[c, Simplify
yc = Evaluate[y[x] /. Sol[[1]]]
yp = Evaluate[y[x] /. Sol[[1]] /. {C[1] c u1, C[2] c u2, C[3] c u3}]
yg = yc + yp
1 1
{{y[x] c C[3] –
Out[25]= C[2] Cos[2 x] + C[1]
Sin[2 x]}} 2 2
Out[26]= Sin 2 x

Out[27]= Cos 2 x

Out[28]= 1

Out[29]= Sin 2 x , Cos 2 x , 1

Out[30]= Sin 2 x , Cos 2 x , 1 , 2 Cos 2 x , – 2 Sin 2 x , 0 , – 4 Sin 2 x , – 4 Cos 2 x , 0

Out[31]//MatrixForm=
Sin[2 x] Cos[ 2 x] 1
2 Cos [2 x ] – 2 Sin [2 x ] 0
– 4 Sin 2 x – 4 Cos 2 x 0

Out[32]= 8

1
Out[33]= – Tan[2 x]
4
1
Out[34]= Log[Cos[2 x]]
8
1
Out[35]= –
4
x
Out[36]= –
4
1
Out[37]= Sec[2 x]
4
4 Anubhav practical 4.nb

1 1 1
Out[38]= – Log[Cos[x] – Sin[x]] + Log[Cos[x] + Sin[x]]
4 2 2
1 1
Out[39]= C[3] – C[2] Cos[2 x] + C[1] Sin[2 x]
2 2
1 1 1 1
Out[40]= x Cos[2 x] + – Log[Cos[x] – Sin[x]] + Log[Cos[x] + Sin[x]] +
8 4 2 2
1
Log[Cos[2 x]] Sin[2 x]
16
1 1
Out[41]= C[3] + x Cos[2 x] – C[2] Cos[2 x] +
8 2
1 1 1
4 – 2 Log[Cos[x] – Sin[x]] + 2 Log[Cos[x] + Sin[x]] +
1 1
C[1] Sin[2 x] + Log[Cos[2 x]] Sin[2 x]
2 16

Question 3 : Solve second order differential equation (d ^ 2 y ) / dx^ 2 + y = Tan (x ) by


variation of parameter method
Solution :
Anubhav practical 4.nb 5

In[42]:= Sol = DSolve[y''[x] + y[x] 0, y[x], x]


sol1 = Evaluate[y[x] /. Sol[[1]] /. {C[1] c
1, C[2]
sol2 c 0}]
= y[x] /. Sol[[1]] /. {C[1] c 0, C[2] c 1}
fs = {sol1, sol2}
wm = {fs, D[fs, x]}
MatrixForm[wm]
wd = Simplify[Det[wm]]
u1 = (Integrate[- sol2 Tan[x], x]) / wd
u2 = (Integrate[sol1 Tan[x], x]) / wd
yc = DSolve[y''[x] + y[x] 0, y[x], x]
yp = Simplify [Evaluate [y [x ] /. Sol [[1 ]] / . { C[ 1] c u1, C 2 c u2
yg = yc + yp [ ] }]]

Out[42]= y x c C 1 Cos x + C 2 Sin x

Out[43]= Cos x

Out[44]= Sin x

Out[45]= Cos x , Sin x

Out[46]= Cos x , Sin x , – Sin x , Cos x


Out[47]//MatrixForm=
Cos[x] Sin[x]
( )
– Sin x Cos x

Out[48]= 1

x x x
Out[49]= Log[Cos[ ] – Sin[ ]] – Log[Cos[ ] +
x 2 2 2 2
Sin[ ]] + Sin[x]
Out[50]= – Cos x

Out[51]= y x c C 1 Cos x + C 2 Sin x

x x x x
Out[52]= Cos[x] (Log[Cos[ ] – Sin[ ]] – Log[Cos[ ] + Sin[ ]])
2 2 2 2
x x
{{Cos[x] (Log[Cos[ ] – Sin[ ]] –
Out[53]=
x x 2 2 2 2
Log[Cos[ (y[x]
] + Sin[ ]]) +
c C[1] Cos[x] + C[2] Sin[x])}}

Question 4 : Solve third order differential equation (d ^ 3 y) / dx^ 3 +


4 dy^ 2 / dx^ 2 + 11 dy / dx - y = e^x by
variation
Solution : of parameter method
6 Anubhav practical 4.nb

In[54]:= Sol = DSolve[y'''[x] - 6 y''[x] + 11 y'[x] - 6 y[x] 0, y[x], x]


sol1 = Evaluate[y[x] /. Sol[[1]] /. {C[1] c
1, C[2]
sol2 c 0,/.
= y[x] C[3] c 0}] /. {C[1] c 0, C[2] c
Sol[[1]]
1, C[3] c 0}
sol3 = y[x] /. Sol[[1]] /. {C[1] c 0, C[2] c 0, C[3] c 1}
fs = {sol1, sol2, sol3}
wm = {fs, D[fs, x], D[fs, {x, 2}]};
MatrixForm[wm]
wd = Simplify[Det[wm]]
a = (1 / wd Det[{{0, sol2, sol3}, {0, D[sol2, x], D[sol3, x]},
{ Exp[x], D[sol2, {x, 2}], D[sol3, {x,
2}]}}]) //x]Simplify
u1 = Integrate[a,
b = (1 / wd Det[{{sol1, 0, sol3}, {D[sol1, x], 0, D[sol3, x]},
{ D[sol1, {x, 2}], Exp[x], D[sol3, {x,
2}]}}]) //x]Simplify
u2 = Integrate[b,
c = (1 / wd Det[{{sol1, sol2, 0}, {D[sol1, x], D[sol2, x], 0},
{ D[sol1, {x, 2}], D[sol2, {x, 2}],
Exp[x]}}])x]// Simplify
u3 = Integrate[c,
yc = Evaluate[y[x] /. Sol[[1]]]
yp = Evaluate[y[x] /. Sol[[1]] /. {C[1] c u1, C[2] c u2, C[3] c u3}]
yg = yc + yp
Out[54]= y x c & x C 1 + &2 x C 2 + & 3 x C 3

Out[55]= &x

Out[56]= &2 x

Out[57]= &3 x

Out[58]= &x, &2 x, &3 x


Out[60]//MatrixForm=

&x &2 x &3 x


&x 2 &2 x 3 &3 x
&x 4 &2 x 9 &3 x

Out[61]= 2 &6 x

1
Out[62]=
2
x
Out[63]=
2
Out[64]= –&–x

Out[65]= &–x

&–2 x
Out[66]=
2
1
Out[67]= – &–2 x
4
Out[68]= &x C 1 + &2 x C 2 + &3 x C 3
Anubhav practical 4.nb 7

3 &x &x x
Out[69]= +
4 2
3 &x &x x
Out[70]= + + &x C[1] + &2 x C[2] + &3 x C[3]
4 2

Question 5 : Solve second order differential equation (x^ 2 d ^ 2 y) / dx^ 2 - 2 y = 4 x - 8


given condition is y[1] = 4, y'[1] = - 1 by
variation
Solution : of parameter method

In[71]:= Sol = DSolve[x^ 2 y''[x] - 2 y[x] 0, y[x], x]


sol1 = Evaluate[y[x] /. Sol[[1]] /. {C[1] c
1, C[2]
sol2 c 0}]
= y[x] /. Sol[[1]] /. {C[1] c 0, C[2] c 1}
fs = {sol1, sol2}
wm = {fs, D[fs, x]}; MatrixForm[wm]
wd = Simplify[Det[wm]]
u1 = (Integrate[- sol2 (4 x - 8), x]) / wd
u2 = (Integrate[sol1 (4 x - 8), x]) / wd
yc = DSolve[x^ 2 y''[x] - 2 y[x] 0, y[x], x]
yp = Evaluate[y[x] /. Sol[[1]] /. {C[1] c u1, C[2] c u2}]
yg = yc + yp
C[2]
Out[71]= {{y[x] c x2 C[1] + }}
x
Out[72]= x2

1
Out[73]=
x
1
Out[74]= {x2, }
x
Out[75]//MatrixForm=
1
x2
x
2x – 1
x2

Out[76]= 3

1
Out[77]= (4 x – 8 Log[x])
3
4 2 x3 x4
Out[78]= – – +
3 3 4

C[2]
Out[79]= {{y[x] c x2 C[1] + }}
x
2 x3 x4
4 (– + ) 1
3 4
Out[80]= – + x2 (4 x – 8 Log[x])
3x 3
3 4
4 (– 2x + x )
3 4 1 C[2]
Out[81]= {{– + x2 (4 x – 8 Log[x]) + y[x] c x2 C[1] + }}
3x 3 x

You might also like