0% found this document useful (0 votes)
408 views6 pages

Mathematica Practicals For Differential Equations

The document discusses solving first, second and third order differential equations with initial conditions and plotting the solution families. It provides examples of solving first order equations, second order equations and third order equations with different initial conditions and plotting the solutions.

Uploaded by

Pratibha Saharan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
408 views6 pages

Mathematica Practicals For Differential Equations

The document discusses solving first, second and third order differential equations with initial conditions and plotting the solution families. It provides examples of solving first order equations, second order equations and third order equations with different initial conditions and plotting the solutions.

Uploaded by

Pratibha Saharan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

1.

Plotting Diff Eq's of first, second and third order


solution families
1.1 Plotting first order solution families
Ques. 1: Solve the first order differential equations, y' = x^3 - x^2 - 1 with y(0) = k, k = 0, 1,
2, 3, as y1,y2,y3,y4 respectively(use legend).
Clear@allD
y '@xD == x ^ 3 - x ^ 2 - 1
DSolve@y '@xD == x ^ 3 - x ^ 2 - 1, y@xD, xD
DSolve@y '@xD == x ^ 3 - x ^ 2 - 1, y, xD
DSolve@8y '@xD == x ^ 3 - x ^ 2 - 1, y@0D k<, y, xD
Plot@y@xD . % . 88k 0<, 8k 1<, 8k 2<, 8k 3<<,
8x, - 2, 2<, PlotStyle 8Thick, Blue<D
y @xD - 1 - x2 + x3
::y@xD - x -

x3

x4
+

+ C@1D>>
4

::y FunctionB8x<, - x ::y FunctionB8x<,

1
12

x3

x4
+

+ C@1DF>>
4

I12 k - 12 x - 4 x3 + 3 x4 MF>>

10
8
6
4
2

-2

Observations-

-1

Practical-1.nb

Ques. 2: Solve the first order differential equations, y' = x^4 - x - 1 with y (0) = k, k = 4, 5,
6, 7, as y1,y2,y3,y4 respectively(use legend).

Clear@allD
y '@xD == x ^ 4 - x - 1
DSolve@y '@xD x ^ 4 - x - 1, y@xD, xD
DSolve@y '@xD == x ^ 4 - x - 1, y, xD
DSolve@8y '@xD == x ^ 4 - x - 1, y@0D k<, y, xD
Plot@y@xD . % . 88k 4<, 8k 5<, 8k 6<, 8k 7<<,
8x, - 2, 2<, PlotStyle 8Thick, Blue<D
y @xD - 1 - x + x4
::y@xD - x -

x2

x5
+

+ C@1D>>
5

::y FunctionB8x<, - x ::y FunctionB8x<,

1
10

x2

x5
+

+ C@1DF>>
5

I10 k - 10 x - 5 x2 + 2 x5 MF>>

8
6
4
2

-2

-1

1
-2

Observations-

Practical-1.nb

1.2 Plotting second order solution families


Ques. 3: Solve the IVP, as second order differential equation y'' + 3 y' + 2 y = 0 with y(0) =
1, y' (0) = k and Plot the Solution for k = -2, -1, 0, 1, 2, as y1,y2,y3,y4 respectively(use
legend)

Clear@allD
y ''@xD + 3 y '@xD + 2 y@xD == 0
DSolve@y ''@xD + 3 y '@xD + 2 y@xD == 0, y, xD
DSolve@8y ''@xD + 3 y '@xD + 2 y@xD == 0, y@0D 1, y '@0D == k<, y, xD
Plot@y@xD . % . 88k - 2<, 8k - 1<, 8k 0<, 8k 1<, 8k 2<<,
8x, - 1, 5<, PlotStyle ThickD
2 y@xD + 3 y @xD + y @xD 0

99y FunctionA8x<, -2 x C@1D + -x C@2DE==


99y FunctionA8x<, -2 x H- 1 + 2 x - k + x kLE==
2.0
1.5
1.0
0.5

-1

1
-0.5
-1.0

Observations-

Practical-1.nb

Ques. 4: Solve the second order differential equation y'' + y' - 6y = 0 with arbitrary
constants k1 and k2 and Plot the Solution for (C1, C2) =(1, 0), (0, 1), (1, 1), (1, -1), (-1, 1),
(5, 1), (1, 5) as y1, y2, y3, y4, y5, y6 and y7 respectively(use legend)

Clear@allD
y ''@xD + y '@xD - 6 y@xD == 0
DSolve@8y ''@xD + y '@xD - 6 y@xD == 0<, y, xD
Plot@y@xD . % . 88C@1D 1, C@2D 0<, 8C@1D 0, C@2D 1<, 8C@1D 1, C@2D 1<,
8C@1D 1, C@2D - 1<, 8C@1D 5, C@2D 1<, 8C@1D 1, C@2D 5<<,
8x, - 1, 1<, PlotRange 8- 5, 15<, PlotStyle ThickD
- 6 y@xD + y @xD + y @xD 0

99y FunctionA8x<, -3 x C@1D + 2 x C@2DE==


15

10

-1.0

-0.5

0.5

-5

Observations-

1.0

Practical-1.nb

1.3 Plotting third order solution families


Ques. 5: Solve the IVP, as third order differential equation y''' + 3 y'' + 4 y' + 12 y = 0 with
y(0) = 0, y' (0) = k, y'' (0) = 0 and Plot the solution for k = -3, -2, -1, 0, 1, 2, 3, as y1, y2, y3,
y4, y5, y6 and y7 respectively(use legend).

Clear@sD
y '''@xD + 3 y ''@xD + 4 y '@xD + 12 y@xD == 0
DSolve@y '''@xD + 3 y ''@xD + 4 y '@xD + 12 y@xD == 0, y, xD
DSolve@8y '''@xD + 3 y ''@xD + 4 y '@xD + 12 y@xD == 0, y@0D 0, y '@0D == k, y ''@0D == 0<, y, xD
Plot@y@xD . % . 88k - 2<, 8k - 1<, 8k 0<, 8k 2<<, 8x, - 1, 10<, PlotStyle ThickD
12 y@xD + 4 y @xD + 3 y @xD + yH3L @xD 0

99y FunctionA8x<, -3 x C@3D + C@1D Cos@2 xD + C@2D Sin@2 xDE==


::y FunctionB8x<,

1
k Sin@2 xDF>>
2

1.0

0.5

-0.5

-1.0

10

Practical-1.nb

Ques. 6: Solve the IVP, as second order differential equation y''' - 6 y'' + 5 y' + 12 y = 0
with y(0) = 0, y' (0) = k, y'' (0) = 0 and Plot the solution for k = -2, -1, 0, 1, 2, as y1, y2, y3,
y4, y5 respectively(use legend).

Clear@sD
y '''@xD - 6 y ''@xD + 5 y '@xD + 12 y@xD == 0
DSolve@y '''@xD - 6 y ''@xD + 5 y '@xD + 12 y@xD == 0, y, xD
DSolve@8y '''@xD - 6 y ''@xD + 5 y '@xD + 12 y@xD == 0, y@0D 0, y '@0D == k, y ''@0D == 0<, y, xD
Plot@y@xD . % . 88k - 2<, 8k - 1<, 8k 0<, 8k 1<, 8k 2<<,
8x, - 1, 10<, PlotStyle ThickD
12 y@xD + 5 y @xD - 6 y @xD + yH3L @xD 0

99y FunctionA8x<, -x C@1D + 3 x C@2D + 4 x C@3DE==


::y FunctionB8x<, -

1
20

-x I7 - 15 4 x + 8 5 x M kF>>

2 109

1 109

2
-1 109

-2 109

10

You might also like