Practical File
Practical File
(Exponential case)
Question 1: Plot the solution of the
differential equation
dY
dt
=0.05 Y, where Y(0) = 1000 over the
domain [0,10].
In[42]:= sol = DSolve[{D[Y[t], t] ⩵ 0.05 * Y[t],
Y[0] ⩵ 1000}, Y[t], t]
Out[42]= Y[t] → 1000. ⅇ0.05 t
In[43]:= Plot[Y[t] /. sol, {t, 0, 10},
PlotStyle → {Thick, Red},
PlotLabel → "Growth Model"]
Growth Model
1600
1500
1400
Out[43]=
1300
1200
1100
2 4 6 8 10
dY
dt
= -0.05 Y, where Y(0) = 5000 over the
domain [0,10].
In[66]:= sol1 = DSolve[{D[Y[t], t] ⩵ -0.05 * Y[t], Y[0] ⩵ 5000}, Y[t], t]
Out[66]= Y[t] → 5000. ⅇ-0.05 t
4500
Out[52]=
4000
3500
2 4 6 8 10
2.0 × 107
1.5 × 107
Out[55]=
1.0 × 107
5.0 × 106
20 40 60 80 100
In[65]:= X[60]
Out[65]= {74 649.8}
t
Solveⅇ c0 ⩵ 0.05 * c0 , t, Reals
-F*
��� ��� V
������ ����� ��� ������ �� ����� ��� ������ ���� ������� ������������ ��� ������ ��� �������� �� ������� �
������������� ����� ������ ��� ������������ ��� �������
2.99573 V
���� �� t →
F
Lake Pollution Model.nb ��� 7
Lake Erie
V=458 x 109 m3 , F = 1.75 x 1011 m3/year
F F
��� ��� sol3 = DSolveC '[t] ⩵ cin - C[t], C[0] ⩵ c0 , C[t], t
V V
Ft Ft
c0 - cin + ⅇ cin
-
���� �� t → ⅇ V V
1.4 × 1010
1.2 × 1010
150 000 000 000 ⅇ-0.382096 t
140 000 000 000 ⅇ-0.382096 t
10
1.0 × 10
���� �� 130 000 000 000 ⅇ-0.382096 t
8.0 × 109 120 000 000 000 ⅇ-0.382096 t
0.05 × 150 × 109
6.0 × 109
Lake Ontario
8 ��� Lake Pollution Model.nb
F F
��� ��� sol5 = DSolveC '[t] ⩵ cin - C[t], C[0] ⩵ c0 , C[t], t
V V
Ft Ft
c0 - cin + ⅇ cin
-
���� �� t → ⅇ V V
20. - 3. + c0
���� �� t → ConditionalExpression0.583333 Log , c0 > 60. || c0 < 3.
- 60. + c0
��� ��� a /. c0 → 6
���� �� {{t → Undefined}}
Lake Pollution Model.nb ��� 9
��� ��� Plot[Evaluate[a /. {{c0 → 6}, {c0 → 5}, {c0 → 4}, {c0 → 3}, {c0 → 2}, {c0 → 1}}],
{t, 0, 8}, PlotLegends → "Expressions", PlotRange → All,
PlotStyle → {Red, Blue, Orange, Dashed, Magenta, Black}]
2 4 6 8
��� ��� Plot[{Evaluate[a /. {c0 → 6}], a /. {c0 → 5}, a /. {c0 → 4}, a /. {c0 → 3},
a /. {c0 → 2}, a /. {c0 → 1}}, {t, 0, 8}, PlotLegends → "Expressions",
PlotRange → All, PlotStyle → {Red, Blue, Orange, Dashed, Magenta, Black}]
5
ⅇ-12 t/7 3 + 3 ⅇ12 t/7
a /. {c0 → 5}
4
a /. {c0 → 4}
���� ��
a /. {c0 → 3}
3
a /. {c0 → 2}
2 a /. {c0 → 1}
2 4 6 8
2 4 6 8
10 ��� Lake Pollution Model.nb
���� ��
5
2 4 6 8
Limited Growth Model without
harvesting
or
Logistic Equation
dX X
dt
= r X 1 - K , X (0) = x0
Question. Solve and plot the limit growth model with r
=1 and K=1000 by taking different initial Values.
��� ��� sol = DSolveX '[t] ⩵ X[t] * 1 - X[t] 1000, X[0] ⩵ a, X[t], t
1000 a ⅇt
���� �� X[t] →
1000 - a + a ⅇt
1000
800
���� �� 600
400
200
2 4 6 8
��� ��� sol1 = DSolveX '[t] ⩵ r * X[t] * 1 - X[t] K, X[0] ⩵ a, X[t], t
a ⅇr t K
���� �� X[t] →
- a + a ⅇr t + K
2 ��� Limit growth model.nb
1000
800
���� �� 600
400
200
2 4 6 8
��� ��� sol2 = DSolveX '[t] ⩵ r * X[t] * 1 - X[t] K, X[0] ⩵ a, X[t], t
a ⅇr t K
���� �� X[t] →
- a + a ⅇr t + K
1000
800
���� �� 600
400
200
2 4 6 8
or
Logistic Equation with harvesting
dX X
dt
= r X 1 - K
- h, X (0) = x0
���� �� X[t] →
3 3 3
t t t
500 + 100 15 - a - 500 ⅇ 5
+ 100 15 ⅇ 5
+aⅇ 5
1000
800
���� �� 600
400
200
2 4 6 8
X[t]
��� ��� sol5 = DSolveX '[t] ⩵ X[t] * 1 - - 500, X[0] ⩵ a, X[t], t
1000
������ ������� ��������� ��� ����� ���� �� ������ �� ���� ��������� ��� ��� �� ������ ��� ������ ��� �������� ��������
������������
1 500 - a
���� �� X[t] → 500 1 + Tan - t - 2 ArcTan ,
2 500
1 1
X[t] → 500 1 + Tan - t + 2 ArcTan - 500 + a
2 500
4 ��� Limit growth model.nb
1000
800
���� �� 600
400
200
0
0 2 4 6 8
1 4 1 9
��� ��� Plot500 1 + Tan - t - 2 ArcTan , 500 1 + Tan - t - 2 ArcTan ,
2 5 2 10
t 1 1
500 1 - Tan , 500 1 + Tan - t - 2 ArcTan ,
2 2 5
1 13
500 1 + Tan - t + 2 ArcTan , {t, 0, 8}, PlotRange → {{0, 8}, {0, 1300}}
2 10
1200
1000
800
���� �� 600
400
200
0
0 2 4 6 8
Limit growth model.nb ��� 5
���� ��
2 4 6 8 10
-2
-4
-6
1200
1000
800
���� �� 600
400
200
0
0 2 4 6 8
dX r
dt = - K X 2-K X + K hr )
9
r = 1, K = 10, h =
10
X[t] 9
��� ��� sol6 = DSolveX '[t] ⩵ X[t] * 1 - - , X[0] ⩵ a, X[t], t
10 10
9 - a - 9 ⅇ4 t/5 + 9 a ⅇ4 t/5
���� �� X[t] →
9 - a - ⅇ4 t/5 + a ⅇ4 t/5
6 ��� Limit growth model.nb
10
���� �� 6
0
0 2 4 6 8
Predator-Prey Model (Lotka–Volterra predator-prey System)
200
150
���� �� 100
50
5 10 15 20
200
150
���� �� 100
50
5 10 15 20
X[t]
��� ��� sol2 = NDSolveX '[t] ⩵ X[t] * 1 - - 0.01 * X[t] * Y[t], Y '[t] ⩵
1000
0.005 * X[t] * Y[t] - 0.5 * Y[t], X[0] ⩵ 200, Y[0] ⩵ 80, {X[t], Y[t]}, {t, 40}
200
150
���� �� 100
50
10 20 30 40
Epidemic Model of Influenza
600
Susceptible
������� 400
Infected
200
5 10 15 20
2 ��� Epidemic copy.nb
��� ��� Plot[T[t] /. sol, {t, 0, 20}, PlotStyle → Black, PlotRange → {{0, 20}, {0, 1000}}]
1000
800
600
���� ��
400
200
0
0 5 10 15 20