Practical-2: Plotting of Third Order Solution Family of Differential Equation
Practical-2: Plotting of Third Order Solution Family of Differential Equation
I n [ ] : = Needs["PlotLegends`"]
sol = DSolve[y '''[x] - 5 y ''[x] + 8 y '[x] - 4 y[x] 0, y[x], x]
sol1 = Evaluate[y[x] /. sol〚1〛 /. {C[1] 1, C[2] 0.5, C[3] 2 / 3}]
sol2 = Evaluate[y[x] /. sol〚1〛 /. {C[1] - 1 / 2, C[2] 0, C[3] 1}]
sol3 = Evaluate [y[x] /. sol〚1〛 /. {C[1] - 1, C[2] - 4, C[3] 2}]
Plot[{sol1, sol2, sol3}, {x, - 5, 3}, PlotRange {- 30, 30},
PlotStyle {{Red, Thickness[0.01]}, {Green, Thick},
{Purple, Thickness[0.02]}}, PlotLegend {sol1, sol2, sol3}]
O u t [ ] =
y[x] x 1 + 2 x 2 + 2 x x 3
O u t [ ] =
2
x + 0.5 2 x + 2 x x
3
O u t [ ] =
x
- + 2 x x
2
O u t [ ] =
- x - 4 2 x + 2 2 x x
O u t [ ] =
30
20
10
-4 -2 2
2
2 x x + x + 0.5
-10
3
x
2 x x - -20
2
-30
2 2 x x - x - 4 2 x
d3 y d2 y dy
Question 2: Solve third order differential equation 3
+3 -25 +21y =0 and plot its any
dx dx2 dx
four solutions.
2 NIDHI P2.nb
Solution:
I n [ ] : =
Needs["PlotLegends`"]
sol = DSolve[y '''[x] + 3 y ''[x] - 25 y '[x] + 21 y[x] 0, y[x], x]
sol1 = Evaluate[y[x] /. sol〚1〛 /. {C[1] 1, C[2] 0, C[3] 2}]
sol2 = Evaluate [y[x] /. sol〚1〛 /. {C[1] - 1 / 2, C[2] 0, C[3] 1}]
sol3 = Evaluate[y[x] /. sol〚1〛 /. {C[1] - 1, C[2] - 4, C[3] 2}]
sol4 = Evaluate[y[x] /. sol〚1〛 /. {C[1] - 0.5, C[2] - 2, C[3] 1}]
Plot[{sol1, sol2, sol3, sol4}, {x, - 0.5, 0.5},
PlotStyle {{Red, Thickness[0.01]}, {Green, Thick}, {Purple, Thickness[0.02]},
{Orange, Thickness[0.01]}}, PlotLegend {sol1, sol2, sol3, sol4}]
O u t [ ] =
y[x] -7 x 1 + x 2 + 3 x 3
O u t [ ] =
-7 x + 2 3 x
O u t [ ] =
1
- -7 x + 3 x
2
O u t [ ] =
- -7 x - 4 x + 2 3 x
O u t [ ] =
- 0.5 -7 x - 2 x + 3 x
O u t [ ] =
20
10
--7 x - 4 x +
-20
-7 x
-0.5 -2
d3 y d2 y dy
Question 3: Solve third order differential equation 3
-4 -25 +28y =0 and plot its any
dx dx2 dx
four solutions .
solution:
NIDHI P2.nb 3
I n [ ] : = Needs["PlotLegends`"]
eqn = y '''[x] - 4 * y ''[x] - 25 * y '[x] + 28 * y[x]
sol = DSolve[eqn 0, y[x], x]
sol1 = Evaluate[y[x] /. sol〚1〛 /. {C[1] 1, C[2] 0, C[3] 2}]
sol2 = y[x] /. sol〚1〛 /. {C[1] - 2, C[2] 10, C[3] 3}
sol3 = y[x] /. sol〚1〛 /. {C[1] - 1, C[2] - 4, C[3] 20}
sol4 = y[x] /. sol〚1〛 /. {C[1] - 0.5, C[2] - 2, C[3] 1}
Plot[{sol1, sol2, sol3, sol4}, {x, - 0.5, 0.5},
PlotStyle {{Red, Thickness[0.01]}, {Green, Thick}, {Purple, Thickness[0.02]},
{Orange, Thickness[0.01]}}, PlotLegend {sol1, sol2, sol3, sol4}]
O u t [ ] =
y[x] -4 x 1 + x 2 + 7 x 3
O u t [ ] =
-4 x + 2 7 x
O u t [ ] =
- 2 -4 x + 10 x + 3 7 x
O u t [ ] =
- -4 x - 4 x + 20 7 x
O u t [ ] =
- 0.5 -4 x - 2 x + 7 x
O u t [ ] =
80
60
40
- 4 x + 2 7 x
20
-2 -4 x + 10
--4 x -0.4
- 4 x + -0.2 0.2 0.4
-0.5 -4 x - 2
d3 y d2 y dy
Question 4: Solve third order differential equation - 13 +19 +33y = cos(2 x) and plot
dx3 dx2 dx
its any four solutions.
Solution:
4 NIDHI P2.nb
I n [ ] : =
4 × 1027
3 × 1027
2 × 1027
-x + 2 11 x +
27
110
× 10
- x + 3 3
--x - 7 3 x
4.5 5.0 5.5 6.0
-10.5 -x + 2