Method of Variation of Parameter

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Q.

1 Solve the equation by variation of Parameter


y’’(x)-5y’(x)+6*y(x)=2ⅇ x
In[1]:= eqn1 = D[D[y[x], x], x] - 5 * D[y[x], x] + 6 * y[x] ⩵ 0
Out[1]= 6 y[x] - 5 y′ [x] + y′′ [x] ⩵ 0

In[2]:= yc = DSolve[eqn1, y[x], x]


Out[2]= y[x] → ⅇ2 x C[1] + ⅇ3 x C[2]

In[3]:= y1 = Exp[2 * x]
Out[3]= ⅇ2 x

In[4]:= y2 = Exp[3 * x]
Out[4]= ⅇ3 x

In[5]:= w = Wronskian[{y1, y2}, x]


Out[5]= ⅇ5 x

In[6]:= r = 2 * Exp[x]
Out[6]= 2 ⅇx

In[7]:= v1 = Integrate- y2 * r  w, x


Out[7]= 2 ⅇ-x

In[8]:= 2 ⅇ-x
v2 = Integratey1 * r  w, x
Out[8]= 2 ⅇ-x

Out[9]= - ⅇ-2 x

In[10]:= yp = y1 * v1 + y2 * v2
Out[10]= ⅇx

In[11]:= Sol = yc + yp
Out[11]= ⅇx + y[x] → ⅇ2 x C[1] + ⅇ3 x C[2]

In[12]:=

ClearAll
Out[12]= ClearAll

Q .2 Solve the equation by variation of Parameter


p
y '' (x) + 4 * y (x) = sec ^ 2 (x)

In[13]:= eqn2 = D[D[y[x], x], x] + 4 * y[x] ⩵ 0


Out[13]= 4 y[x] + y′′ [x] ⩵ 0
2 aysha.nb

In[14]:= yc = DSolve[eqn2, y[x], x]


Out[14]= {{y[x] → C[1] Cos[2 x] + C[2] Sin[2 x]}}

In[15]:= y1 = Cos[2 * x]
Out[15]= Cos[2 x]

In[16]:= y2 = Sin[2 * x]
Out[16]= Sin[2 x]

In[18]:= w = Wronskian[{y1, y2}, x]


Out[18]= 2

In[19]:= r = Sec[x] * Sec[x]


Out[19]= Sec[x]2

In[20]:= v1 = Integrate- y2 * r  w, x


Out[20]= Log[Cos[x]]

In[21]:= v2 = Integratey1 * r  w, x

Out[21]=
1 2 x - Tan[x]
2

In[22]:= yp = y1 * v1 + y2 * v2

Out[22]= Cos[2 x] Log[Cos[x]] + 1 Sin[2 x] 2 x - Tan[x]


2

In[23]:= Solution = yc + yp

Out[23]= Cos[2 x] Log[Cos[x]] + y[x] → C[1] Cos[2 x] + C[2] Sin[2 x] + 1 Sin[2 x] 2 x - Tan[x]
2

In[24]:= ClearAll
Out[24]= ClearAll

Q .3 Solve the equation by variation of Parameter


y '' (x) + y (x) = tan (x)

In[25]:= eqn1 = D[D[y[x], x], x] + y[x] ⩵ 0


Out[25]= y[x] + y′′ [x] ⩵ 0

In[26]:= yc = DSolve[eqn1, y[x], x]


Out[26]= {{y[x] → C[1] Cos[x] + C[2] Sin[x]}}

In[27]:= y1 = Cos[x]
Out[27]= Cos[x]

In[28]:= y2 = Sin[x]
Out[28]= Sin[x]
aysha.nb 3

w = Wronskian[{y1, y2}, x]
1

In[29]:= r = Tan[x]
Out[29]= Tan[x]

In[30]:= v1 = Integrate- y2 * r  w, x

Out[30]=
1 LogCos x  - Sin x  - LogCos x  + Sin x  + Sin[x]
2 2 2 2 2

In[31]:= v2 = Integratey2 * r  w, x

Out[31]=
1 - LogCos x  - Sin x  + LogCos x  + Sin x  - Sin[x]
2 2 2 2 2

In[32]:= yp = y1 * v1 + y2 * v2

Out[32]=
1 - LogCos x  - Sin x  + LogCos x  + Sin x  - Sin[x] Sin[x] +
2 2 2 2 2
1 Cos[x] LogCos x  - Sin x  - LogCos x  + Sin x  + Sin[x]
2 2 2 2 2

In[33]:= sol = yc + yp
Out[33]= y[x] → C[1] Cos[x] + C[2] Sin[x] +
1 - LogCos x  - Sin x  + LogCos x  + Sin x  - Sin[x] Sin[x] +
2 2 2 2 2
1 Cos[x] LogCos x  - Sin x  - LogCos x  + Sin x  + Sin[x]
2 2 2 2 2

In[40]:= ClearAll
Out[40]= ClearAll

Q .3 Solve the equation by variation of Parameter


y '' (x) - 2 y ' (x) = e ^ x.sin (x)

In[53]:= eqn4 = D[D[y[x], x], x] - 2 * D[y[x], x] ⩵ 0


Out[53]= - 2 y′ [x] + y′′ [x] ⩵ 0

In[54]:= yc = DSolve[eqn4, y[x], x]

Out[54]= y[x] → 1 ⅇ2 x C[1] + C[2]


2

In[55]:= y1 = 1  2 * Exp[2 * x]

Out[55]=
ⅇ2 x
2

In[56]:= y2 = 1
Out[56]= 1

In[57]:= w = Wronskian[{y1, y2}, x]


Out[57]= - ⅇ2 x
4 aysha.nb

In[58]:= r = Exp[x] * Sin[x]


Out[58]= ⅇx Sin[x]

In[59]:= v1 = Integrate- y2 * r  w, x

Out[59]= - 1 ⅇ-x Cos[x] + Sin[x]


2

In[60]:= v2 = Integratey1 * r  w, x

Out[60]= - 1 ⅇx - Cos[x] + Sin[x]


4

In[61]:= yp = y1 * v1 + y2 * v2

Out[61]= - 1 ⅇx - Cos[x] + Sin[x] - 1 ⅇx Cos[x] + Sin[x]


4 4

In[62]:= sol = yc + yp

Out[62]= y[x] → 1 ⅇ2 x C[1] + C[2] - 1 ⅇx - Cos[x] + Sin[x] - 1 ⅇx Cos[x] + Sin[x]


2 4 4

You might also like