Professional Documents
Culture Documents
Exercise 1: Solve the second-order ODE using the method of variation of parameters
d2 y dy et
−2 ∙ + y=
d t2 dt t 2 +1
Given that:
0∧dy
y ¿t =o= ¿ =1
dt t=o
Solution:
d2 y dy et
−2 ∙ + y= (1)
d t2 dt t 2 +1
− (− 2) A
t
2
y h=e ( C1 +tC 2 )
Y h=et ( C 1 +tC 2 )
y h (t)=e t C1 +C 2 e t t (3)
Using Eq. (3) in this case the fundamental solutions and their derivatives are:
W ( y 1 , y2 ) = y 1 y '2 − y '1 y 2
W ( y 1 , y2 ) =e t (e t +t e t)−e t (tet )
W ( y 1 , y2 ) =e 2 t +t e 2 t−te 2t
W ( y 1 , y2 ) =e 2 t
Find y p ( t )
y 2 ( t ) . f (t) y ( t ) . f (t )
y p=− y 1∫ + y 1∫ 1
W ( y1 , y2 ) W ( y1 , y2 )
et et
(t e t ). et .
t 2 +1 t 2+ 1
y p=−et ∫ 2t
dt+t e t∫ dt
e e2 t
t 1
y p=−et ∫ 2
dt +t e t∫ 2 dt
t +1 t +1
−e t 2 t t 1
y p= ∫ 2+1
dt +t e ∫ 2 dt
2 t t +1
−et
y p (t)= ¿ (4)
2
So the general solution for the given ODE
y (t)= y h (t)+ y p (t )
t t et 2 t
y ( t ) =e C 1 +C2 e t− ( ln ( t +1 ) )+ t e (arctan ( t ) ) (5)
2
1 t 2t et d d t
' t t t
y ( t )=e C 1+C 2 e t +C 2 e − e 2
2 ( )
t +1 2
2 t
− ( ln ( t +1 ) ) +e ( arctan ( t ) ) ( t ) +t ( e ( arctan ( t ) ) )
dt dt
t
(t ) e d d
y ' ( t )=et C 1+C 2 et t +C 2 e t −et 2
(t + 1) 2 [
− ( ln ( t 2+1 ) ) + et ( arctan ( t ) ) (1)+t e t ( arctan ( t ) ) + ( arctan ( t ) ) ( e t )
dt dt ]
t t
' t t t t (t ) e 2 t e t
y ( t )=e C 1+C 2 e t +C 2 e −e 2 − ( ln ( t +1 ) ) +e ( arctan ( t ) ) +t 2 +t ( arctan ( t ) ) ( e )
t +1 2 t +1
t
' t t t e 2 t t
y ( t )=e C 1+C 2 e t +C 2 e − ( ln ( t + 1 ) ) +e ( arctan (t ) ) +t ( arctan ( t ) ) ( e )
2
(6)
Now find the value of c1 and c2 putting initial condition in eq (5) and (6):
0∧dy
y ¿t =o= ¿ =1
dt t=o
t t et 2+1 t
y t =e C 1 +C2 e t− ( ln ( t ) )+t e ( arctan ( t ))
( )
2
0 0 e0 0
0=e C 1+ C2 e (0)− ( ln ( 0+1 ) )+( 0)e (arctan ( 0 ))
2
0=C1
C 1=0
t
' t t t e 2 t t
y ( t )=e C 1+C 2 e t +C 2 e − ( ln ( t + 1 ) ) +e ( arctan (t ) ) ++t ( arctan ( t ) ) ( e )
2
0
0 0 0 e 0 0
1=e C1 +C 2 e (0)+C 2 e − ( ln ( 0+1 )) + e ( arctan ( 0 ) ) ++( 0) ( arctan ( 0 ) ) ( e )
2
1=C 1 +C2
Putting C 1=0in above equation:
C 2=1
t +1 ) t t 2
− ( ln ( t +1 ) ) +e ( arctan ( t ) ) +
2 2
t
t +1 2
t t
d
t
t t t
t e e e
y ( t )=e t+ e + e −e (
'' t t
)
t +1 2
t t 2
− ( ln ( t +1 ) ) +e ( arctan ( t ) ) +
2
t
t +1 2
t t
+t ( e ) ( arctan ( t ) ) +e ( arctan ( t ) ) +t
t +1
+
2
'' t t t et 2 t et t t t
y ( t )=e t+ e + e − ( ln ( t +1 ) ) + e ( arctan ( t ) )+ 2 +t ( e ) ( arctan ( t ) ) +e ( arctan ( t ) ) +t ( arctan ( t ) ) ( e )
2 t +1
et ( 2 ) t t
t t
¿ e t+ e + e −
t
( ln t +1 ) + e ( arctan ( t ) )+ 2e +t ( e t ) ( arctan ( t ) )
2 t +1
+e t ( arctan ( t ) ) +t ( arctan ( t ) ) ( et )−2 e t t+2 e t +e t ( ln ( t 2 +1 ) )
t t t et 2 t
−2 e ( arctan ( t ) )−2 t ( e ) ( arctan ( t ) ) +e t− (ln ( t +1 ) )+t e (arctan ( t ) )
2
et
¿
t 2 +1
et
R.H.S¿
t 2 +1
L.H.S ¿R.H.S
So, given general solution satisfies the given ODE
Exercise 2: A damped harmonic oscillator is described by the following ODE
d2 y dy
m 2 + c + k . y=0
dt dt
Where m is the mass, c is the damping constant and is the spring constant.
Assume m=1 kg and k =25 N /m
Solution:
d2 y dy
m 2
+ c + k . y=0
dt dt
By putting value of m and k the above equation becomes:
d2 y dy
1. 2
+ c +25. y=0
dt dt
d2 y dy
2
+c +25 y=0
dt
(1)
dt
Case 1: Over damping motion
Select the value of the damping constant c that results in overdamping motion.
Derive the particular solution by hand.
Verify the solution.
d2 y dy
2
+c +25 y=0
dt dt
We assume c=16 in above equation
d2 y dy
2
+16 +25 y=0
dt
(2)
dt
The above equation is second order Homogeneous ODE
Calculate General solution for Homogeneous equation, y h (t )
(b) Calculate A2−4 B
Here A=16 , B=25
A2−4 B=¿
If A2−4 B=156, the value of y h is:
y h=c1 e λ t +c 2 e λ t
1 2
(3)
y h (t)=c 1 e−¿ ¿
Which is the required general solution of given ODE
Now verify the solution
y h (t)=c 1 e−¿ ¿
By taking derivative of above equation,
y 'h (t )=−¿
By taking derivative of above equation,
y 'h' ( t )=(−( 8−√ 39 ) )(− ( 8− √39 ) ) c 1 e−¿¿
(−( 8+ √ 39 ) ) c 2 e−( 8+√ 39) t
2 −(8+ 39)t
y 'h' ( t )=(−( 8−√ 39 ) ) c 1 e−¿ ¿ c 2 e √
y 'h' ( t )=64 c 1 e−¿¿
By putting the values of y h ( t ) , y 'h ( t ) , y 'h' ( t ) in equation 2
d2 y dy
2
+16 +25 y=0
dt dt
64 c1 e−¿¿16(−¿
64 c1 e−¿¿
+16 √ 39 c 2 e−( 8+√ 39) t +39 c 2 e− (8+ √39 )t −128 c 1 e−¿ ¿
+128 c 2 e−(8+ √39) t −16 √ 39 c2 e−(8 +√ 39) t +25 c 1 e
−¿ ¿
c 1 e−¿¿
0=0
So, given general solution satisfies the given ODE
− ( 10 )
t
2
y h=e ( c 1+ tc2 )
Y h=e−5t ( c 1+tc 2 )
y h (t)=e−5 t c 1+ c 2 e−5 t t
0=0
So, given general solution satisfies the given ODE
−A
t
2
y h=e ( c1 cos (βt )+c 2 sin (βt))
−5 −5
t 5 3 t 5 √3
y h=c1 e 2
cos ( √ t )+ c 2 e 2
sin ( t)
2 2
−5 −5
t 5 3 5 3 5 3 −5 5 3 5 3 5 t
(− √ sin √ t )+c 1 (cos √ )( (( √ ) cos ( √ t ))+c sin ( √
−5
'
y ( t ) =c 1 e
h ( ) ( )
2
2 2 ( ) 2 2
e¿¿
2
t)+ c2 e
2 2 2
2
2
−5 −5 −5 −5
−5 3 5 3 5 t 5 3 5 3 5 3 5 5 3 t
y ( t ) = √ c e ( sin ( √ t ))− c e cos ( √ t ) + √ c e ( cos ( √ t )) − c e sin ( √ t)
' t t
2 2 2 2
h 1 1 2 2
2 2 2 2 2 2 2 2
By taking derivative of above equation,
−5 −5
−5 √3 5 3 5 3 5 3 5 3 −5 5
( 5 √23 )sin ( 5 √2 3
t t
(( √ )cos ( √ t))− √ c1 (sin √ )(
−5
''
y ( t )=
h
2
c1 e 2
2 2 2 2 2
e ¿¿
2 2 ( )
t)− c 1 e 2
(−
−5 −5 −5 −5
t 5 3 25 3 t 5 3 25 3 t 5 √3 25 5 3
cos √ t + √ c 1 e sin √ + √ c 1 e t + c 1 e 2 cos √ t
''
y ( t )=
h
−75
4 1
c e 2
( ( ))
2 4
2
( ( ))
2 4
2
(
sin
2 ) 4
t
2 (
−5 −5 −5 −5
t 5 √3 25 3 t 5 √3 25 t 5 √3 25 3 t
5 √3
t + √ c1 e t − √ c2 e
y 'h' ( t )=
−25
2 1
c e 2
( ( ))
cos
2 2
2
( ( ))
sin
2
− c2 e
2
2
( ( ))
sin
2 2
2
cos ( 2
0=0
So, given general solution satisfies the given ODE
d2 y dy 85
2
+6 +8 y− cos( t)=0
dt dt 2
Given that:
3∧dy
y ¿t =o= ¿ =5
dt t=o
Solution:
d2 y dy 85
2
+6 +8 y− cos( t)=0
dt dt 2
d2 y dy 85
2
+6 +8 y= cos( t) (1)
dt dt 2
The corresponding Homogenous is :
d2 y dy
2
+6 +8 y=0 (4)
dt dt
Calculate General solution for Homogeneous equation, y h (t )
(e) Calculate A2−4 B
Here A=6 , B=8
A2−4 B=¿
If A2−4 B=4, the value of y h is:
y h=c1 e λ t +c 2 e λ t
1 2
(3)
−6 ± √36−32
λ=
2
−6 ± √ 4 −16 ±2
λ= =
2 2
λ=−3 ±1
So, λ 1=−3+1=−2∧¿ λ 2=−3−1=−4
By putting values of λ 1and λ 2
y h ( t ) =c 1 e λ t +c 2 e λ t
1 2
c 1 e−¿¿
0=0
So, given general solution satisfies the given ODE
Tasks:
1. Transform equation in a separable form.
2. Find out the general solution by hand.
3. Use python to calculate integrals from the left-hand and right-hand sides of separable ODE.
4. Write a python program to solve the differential equation in a separable form utilizing dsolve function.
5. Verify the general solution.
Solution:
dy 1+ y 2
+ 2 =0
dx x y (1+ x 2)
dy −1+ y 2
= 2
dx x y (1+ x2 )
------------------(1)
y 2 dy −1
2
= 2
1+ y dx x (1+ x )
y2 −1
2
dy= dx
1+ y ( x+ x3 )
By integration on B.S of above equation
y2
∫ 1+ y 2 dy=−∫ ( 1 3 ) dx
x+x
2
∫ 1+1+y y−1
2
dy=−∫
1
dx
3 1
(
x 2+x
x
3
)
1+ y 2
∫ 1+ y 2 dy−∫ 1+1y 2 dy =−∫ 1
dx
3 1
( )
x 2 +1
x
1 1
∫ 1 dy−∫ 1+ y 2 dy =−∫ 1
dx
x
3
( )
x2
+1
y−arctany=−I --------------------------(2)
So,
1
I =∫ dx
3 1
( ) x 2 +1
x
Let ( x1 )
u= +1 2
du −2
=
dx x 3
−x 3
dx= du
2
1
I =∫ dx
3 1
( )
x 2 +1
x
−1 1
I= du
2 ∫u
−1
I= ln ¿ )+c
2
−1
I= ln ¿ )+c
2
1
y−arctany=−
[ ( )]
−1
2
ln 2 +1 + c
x
1 1+ x 2
y−arctany= ln
2 x2 ( )
+c
1 1
y−arctany= ln ( 1+ x 2 )− ln ( x 2 ) +c
2 2
1 2
y−arctany= ln ( 1+ x 2 )− ln ( x ) +c
2 2
1
y−arctany= ln ( 1+ x 2 )−ln ( x ) +c ----------------(3)
2
The above equation is general solution.
Verify that solution satisfy the ODE
1
y−arctany= ln ( 1+ x 2 )−ln ( x ) +c
2
1 dy 1 1 1
( 1+ y ) dx 2 ( 1+ x ) x
1− =2
( 2 x )−
2
1+ y 2−1 d y x 1
( 1+ y 2 ) ( )
dx
=
1+ x 2
−
x
y 2 d y x 2−1−x2
( ) =
1+ y 2 dx x (1+ x 2)
y 2 d y x 2−1−x2
( )2
1+ y dx
= 2
x (1+ x )
y2 d y
( )
1+ y 2
dx
=
−1
x (1+ x 2)
dy −1+ y 2
= 2
dx x y (1+ x 2)
--------------------(4)
Tasks:
1. Find the general solution by hand.
2. Find the particular solution by hand.
3. Write a python program to find the general and particular solutions to the original differential equation
utilizing dsolve function.
4. Verify the particular solution.
5. Make a plot in python for the particular solution.
Solution:
dy
+ y . tanx=sin 2 x -------------------(1)
dx
dy
Compare above equation with standard form ∵
dx
+ P ( x ) . y=Q(x )
dy
+ y . tanx=sin 2 x
dx
P ( x ) =tanx ,Q ( x )=sin(2 x )
Integrate
sinx
∫ P ( x ) dx=∫ tanx dx=∫ cosx dx=−ln ( cosx )
Integration Factor
1
e∫ P ( x ) dx=e−ln (cosx )=e ln (cosx ) =(cosx)−1 =
−1
cosx
1
So, I.F=¿ cosx
Substitute the I.F into following equation
P ( x ) dx
y . e∫ =∫ ( e¿¿ ∫ P ( x ) dx ). Q ( x ) dx +c ¿
1 1
y. =∫ ( ). sin 2 xdx+ c
cosx cosx
1 1
y. ). 2 sinxcosxdx +c
cosx ∫ cosx
= (
1
y. =2 ∫ sinxdx +c
cosx
1
y. =−2 cosx + c
cosx
1=−2(1)+c (1)
1=−2+ c
c=3
y ( x=0 )=−2+ 3
y ( x=0 )=1
Solution:
dy
y2 . −5 y 3=e−2 x
dx
Dividing the above equation by y 2on B.S
dy e−2 x
−5 y= 2
dx y
dy
−5 y=e−2 x . y−2 -----------------------------------(1)
dx
The equation (1) is Bernoulli’s with
P ( x ) =x 0=1 , R ( x )=e−2 x , α =−2
A linear equation using change of variables is used
v= y 1−α
1−(−2)
v= y
v= y 3
1
y=v 3
Taking derivative w.r.t x of above equation
−2
dy 1 dv3
= v
dx 3 dx
dy
By putting values of ‘y’ and dx in equation (1)
−2 1 −2
1 3 dv
v −5 v 3 =e−2 x . v 3
3 dx
−2
By dividing above equation by v 3 on B.S
1
3
1 dv v
−5 −2 =e−2 x
3 dx
v3
1 dv
−5 v=e−2 x
3 dx
Multiply above equation by 3
dv
−15 v=3 e−2 x
dx
Which is linear equation
So, P ( x ) =−15 ,Q ( x )=3 e−2 x
Integrate
∫ P ( x ) dx=∫ −15 dx=−15 x
Integration Factor
P ( x ) dx
e∫ =e−15 x
−3 −17 x
v . e−15 x = e +c
17
y=
√ 17
-------------------------------(2)
3 −3 e
17
−17(0)
+17 c e15 (0 )
1=
√ 0
17
3 −3 e +17 c e
0
1=
√ 17
3 −3 ( 1 )+ 17 c ( 1 )
1=
√
3 −3+17 c
17
−3 e−17 x
17
+20 e15 x
17
)e
y=
√
3
17
----------------------(3)
0
17
3 −3 e + 20 e
0
y=
√ 17
y=
√
3 −3(1)+20(1)
17
y=
√
3 −3+20
17
17
y=
3
y= √13
17 √
y ( x=0 )=1