0% found this document useful (0 votes)
24 views5 pages

System of Differential Equations: Practical-3

The document contains solutions to three systems of differential equations: 1) An initial value problem with solutions expressed in terms of trigonometric functions. 2) An initial value problem solved numerically showing oscillatory behavior. 3) An initial value problem with solutions containing exponential and trigonometric terms. Plots of the solutions are shown for each problem.

Uploaded by

nidhikoshalia
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)
24 views5 pages

System of Differential Equations: Practical-3

The document contains solutions to three systems of differential equations: 1) An initial value problem with solutions expressed in terms of trigonometric functions. 2) An initial value problem solved numerically showing oscillatory behavior. 3) An initial value problem with solutions containing exponential and trigonometric terms. Plots of the solutions are shown for each problem.

Uploaded by

nidhikoshalia
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/ 5

PRACTICAL-3

System of Differential Equations

Q1: Solve the system of differential equation


x y -1
=2y = x
t t 4
x(0)=2, y(0)= 1

Solution :
sol =
DSolve[ {x '[t]  2 * y[t], y '[t]  - 1 / 4 * x[t] , x[0]  2, y[0]  1}, {x[t], y[t]}, t]
t t 1 t t
x[t]  2 Cos + 2 Sin  , y[t]  2 Cos - 2 Sin  
2 2 2 2 2
2 NIDHI P3.nb

h1 = Plot[{x[t] /. sol , y[t] /. sol}, {t, 0, 4 Sqrt[2] π},


AxesLabel  {"t", "x,y"} PlotStyle  {Green, Blue}, PlotLegends  {"x[t]", "y[t]"}]

h2 = ParametricPlot[{x[t], y[t]} /. sol, {t, 0, 2 Sqrt[2] π}, AxesLabel  {"x", "y"}]


Show[GraphicsArray[{h1, h2}]]
{PlotStyle t, PlotStyle x,y}  { , }

1 x[t]

5 10 15
y[t]
-1

-2

-3

1.0

0.5

x
-3 -2 -1 1 2 3
-0.5

-1.0

GraphicsArray: GraphicsArray is obsolete. Switching to GraphicsGrid.

PlotStyle t, PlotStyle x,y}  { , } y


3 1.0
2 0.5
1
x
-1 5 10 15 -3 -2 -1
-0.5 1 2 3
-2 -1.0
-3

Q2: Solve the system of differential equation


x y
=y = (1-x^2)y - x
t t
x(0) = 1, y(0) = 1

Solution :
NIDHI P3.nb 3

Sol1 = NDSolve[{x '[t]  y[t], y '[t]  (1 - x[t] ^ 2) * y[t] - x[t], x[0]  1, y[0]  1 },
{x[t], y[t]}, {t, 0, 30}]

Domain: {{0., 30.}}


x[t]  InterpolatingFunction Output: scalar
[t],

Domain: {{0., 30.}}


y[t]  InterpolatingFunction Output: scalar
[t]

k1 = Plot[{x[t] /. Sol1, y[t] /. Sol1},


{t, 0, 25}, AxesLabel  {"t", "x,y"}, PlotStyle  {Blue, Red}]
k2 = ParametricPlot[{x[t], y[t]} /. Sol1,
{t, 0, 25}, AxesLabel  {"x", "y"}, PlotStyle  Dotted]
Show[GraphicsArray[{k1, k2}]]

x,y

t
5 10 15 20 25

-1

-2
4 NIDHI P3.nb

x
-2 -1 1 2

-1

-2

GraphicsArray: GraphicsArray is obsolete. Switching to GraphicsGrid.

x,y
2

2
1
1
t x
5 10 15 20 25 -2 -1 1 2
-1
-1
-2

-2

Q3 Solve the system of differential equation


x y
=y +5x+2y=1
t t
x(0) = 0, y(0) = -1

Solution :
Sol2 = DSolve[
{x '[t]  y[t], y '[t]  - 5 * x[t] - 2 * y[t] + 1, x[0]  0, y[0]  - 1}, {x[t], y[t]}, t]
1
x[t]  -t - Cos[2 t] + t Cos[2 t]2 - 3 Sin[2 t] + t Sin[2 t]2 ,
5
y[t]  - -t (Cos[2 t] - Sin[2 t])
NIDHI P3.nb 5

s1 = Plot[{x[t] /. Sol2, y[t] /. Sol2}, {t, 0, 3 π}, AxesLabel  {"t", "x,y"},


PlotStyle  {Pink, Cyan}, PlotLegends  {"x[t]", "y[t]"}]
s2 = ParametricPlot[{x[t], y[t]} /. Sol2, {t, 0, 3 π},
AxesLabel  {"X", "Y"}, PlotStyle  Dashed, PlotRange  {- 1, 0.5}]
Show[GraphicsArray[{s1, s2}]]
x,y

0.4

0.2
x[t]
y[t]
t
2 4 6 8

-0.2

0.4

0.2

X
-1.0 -0.5 0.5

-0.2

-0.4

-0.6

-0.8

-1.0

GraphicsArray: GraphicsArray is obsolete. Switching to GraphicsGrid.

0.4
y
0.2

X
-1.0 -0.5 0.5
-0.2
t -0.4
2 4 6 8
-0.6

-0.8

-1.0

You might also like