Repository navigation
Expand file tree
/
Copy pathDifferentialEquations.Rmd
More file actions
1430 lines (919 loc) · 28 KB
/
Copy pathDifferentialEquations.Rmd
File metadata and controls
1430 lines (919 loc) · 28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Differential Equations
## Modeling with Differential Equations
In mathematical modeling, we often describe real-world phenomena by focusing on how quantities change over time or space. When a model involves an unknown function and one or more of its derivatives, it is called a **differential equation**.
This makes sense because many real systems are driven by change:
- populations grow or decline,
- objects move and accelerate,
- temperatures change,
- springs oscillate,
- chemicals react.
Differential equations allow us to **predict future behavior** using information about **current change**.
---
### Population Growth Models
<div class="note">
**Exponential Growth Model**
Let:
- \(t\) = time (independent variable)
- \(P(t)\) = population size (dependent variable)
> Assumption: The rate of change of the population is proportional to the population size.
This leads to the differential equation:
\[
\frac{dP}{dt} = kP
\]
where \(k\) is a constant.
</div>
**Interpretation:**
- If \(k > 0\), the population always increases.
- As \(P\) increases, \(\frac{dP}{dt}\) increases → **faster growth over time**.
- Growth rate depends on current population size.
The solutions are exponential functions:
\[
P(t) = Ce^{kt}
\]
If \(P(0) = P_0\), then:
\[
C = P_0 \quad \Rightarrow \quad P(t) = P_0 e^{kt}.
\]
This is the exponential growth model.
::: {.example}
Exponential Growth
**Model:**
\[
\frac{dP}{dt} = 0.3P, \quad P(0)=100
\]
**Solution:**
\[
P(t) = 100e^{0.3t}
\]
**Interpretation:**
Population grows exponentially from an initial size of 100.
:::
<div class="note">
**Logistic Growth Model (Limited Resources)**
Real environments have **limited resources**, so unlimited exponential growth is unrealistic. To model this, we introduce the **carrying capacity** \(M\):
\[
\frac{dP}{dt} = kP\left(1 - \frac{P}{M}\right).
\]
This is the **logistic differential equation**.
**Behavior of the Logistic Model:**
- If \(P\) is small:
\(\frac{P}{M} \approx 0 \Rightarrow \frac{dP}{dt} \approx kP\) → exponential growth
- If \(P > M\):
\(1 - \frac{P}{M} < 0 \Rightarrow \frac{dP}{dt} < 0\) → population decreases
- If \(P \to M\):
\(\frac{dP}{dt} \to 0\) → population levels off
**Equilibrium Solutions:**
\[
P(t) = 0, \qquad P(t) = M
\]
These are **equilibrium solutions**:
- \(P=0\): extinction equilibrium
- \(P=M\): stable carrying capacity equilibrium
Solutions move **away from 0** and **toward \(M\)**.
</div>
**Logistic Interpretation**
- If \(P(0) < M\): population increases toward \(M\)
- If \(P(0) > M\): population decreases toward \(M\)
**Conclusion:** Logistic growth stabilizes naturally.
---
### Physical Model: Motion of a Spring
Consider a mass \(m\) attached to a spring.
From physics:
- **Hooke’s Law:** restoring force \(= -kx\)
- **Newton’s Second Law:** \(F = m a = m \frac{d^2x}{dt^2}\)
This gives the differential equation:
\[
m\frac{d^2x}{dt^2} = -kx
\]
or
\[
\frac{d^2x}{dt^2} = -\frac{k}{m}x
\]
**Interpretation**
The acceleration is proportional to displacement but in the opposite direction. This produces oscillatory motion. Solutions are combinations of sine and cosine:
\[
x(t) = A\cos(\omega t) + B\sin(\omega t).
\]
This matches physical intuition: springs oscillate.
---
### General Differential Equations
A **differential equation**:
- Contains an unknown function
- Contains one or more derivatives of that function
**Order**
- **First-order:** highest derivative is first derivative
- **Second-order:** highest derivative is second derivative
- etc.
<div class="definition">
A function \(f(x)\) is a **solution** if substituting it and its derivatives into the equation makes the equation true.
The general solution is a **family of solutions** with constants:
\[
y = f(x) + C
\]
A differential equation **plus** an initial condition:
\[
y(t_0) = y_0.
\]
This selects **one unique solution** from the family.
</div>
::: {.example}
General Solution Check
Given:
\[
y = \frac{1+ce^t}{1-ce^t}
\]
This family satisfies:
\[
y' = \frac{1}{2}(y^2 - 1)
\]
Every value of \(c\) gives a valid solution → **general solution**.
:::
::: {.example}
Initial-Value Problem
Given:
\[
y' = \frac{1}{2}(y^2 - 1), \qquad y(0)=2
\]
From the general solution:
\[
y = \frac{1+ce^t}{1-ce^t}
\]
Apply the initial condition:
\[
2 = \frac{1+c}{1-c}
\Rightarrow c = \frac{1}{3}
\]
**Final solution:**
\[
y(t) = \frac{3+e^t}{3-e^t}
\]
:::
---
### Putting It All Together
Differential equations are the language of change. They connect mathematics to reality by turning:
> “How something changes” into “What will happen next.”
They form the foundation of modeling in:
- biology (population, epidemics),
- physics (motion, forces, energy),
- chemistry (reaction rates),
- economics (growth models),
- engineering (systems and control),
- data science and ML (dynamics and optimization).
They are not just equations — they are predictive models of the real world.
#### Conceptual Takeaways
- Differential equations model **change-driven systems**
- Models come from **physical laws** or **empirical assumptions**
- Realistic models must include **constraints** (e.g. carrying capacity)
- Differential equations describe **dynamics**, not just values
- Many systems naturally lead to:
- exponential growth/decay
- logistic stabilization
- oscillatory motion
- Initial conditions are essential for **prediction**
- One equation can describe infinitely many behaviors
---
#### Skills You Should Be Able to Do
After this section, you should be able to:
- Explain what a **differential equation** is
- Identify the **order** of a differential equation
- Interpret differential equations in real-world terms
- Build simple models from assumptions
- Recognize:
- exponential growth models
- logistic growth models
- oscillation models
- Understand equilibrium solutions
- Distinguish between:
- general solutions
- particular solutions
- Solve simple **initial-value problems**
- Interpret solutions physically and graphically
- Explain why differential equations are used in modeling
---
#### Problems
## Direction Fields and Euler’s Method
In most real-world applications, differential equations cannot be solved explicitly in closed form. This means we often cannot write solutions as formulas. However, we can still understand solution behavior using:
- **Graphical methods** → direction (slope) fields
- **Numerical methods** → Euler’s method
These approaches allow us to:
- Visualize solution curves
- Predict long-term behavior
- Approximate solutions at specific points
- Interpret physical and biological models
---
### Direction Fields (Slope Fields)
A first-order differential equation has the form
\[
y' = F(x,y).
\]
At each point \((x,y)\), the value \(F(x,y)\) gives the **slope** of the solution curve at that point. A **direction field** is a collection of short line segments drawn at many points \((x,y)\), each with slope \(F(x,y)\). These line segments show the *direction* in which solution curves must flow. This allows us to sketch solution curves without solving the equation.
::: {.example}
Basic Direction Field
\[
y' = x + y, \qquad y(0) = 1
\]
At any point \((x,y)\), the slope is:
\[
\text{slope} = x + y.
\]
So:
- At \((0,1)\): slope = \(1\)
- At \((1,2)\): slope = \(3\)
- At \((-1,1)\): slope = \(0\)
**Solution Behavior**
1. Draw short line segments with slope \(x+y\) at many points.
2. Start at the initial point \((0,1)\).
3. Trace a curve that stays **parallel to the local line segments**.
This produces a smooth solution curve following the direction field. See the textbook.
:::
---
### Autonomous Differential Equations
An equation of the form
\[
y' = f(y)
\]
is called **autonomous** (no explicit \(x\) dependence).
**Key Properties:**
- Slopes depend only on \(y\)
- Direction field has **horizontal translation symmetry**
- Solutions can be shifted left/right in \(x\)
- Constant solutions \(y = C\) where \(f(C)=0\) are called equilibrium solutions
::: {.example}
Equilibrium Solutions
\[
\frac{dI}{dt} = 15 - 3I
\]
**Equilibrium Condition**
\[
0 = 15 - 3I \Rightarrow I = 5
\]
So:
\[
I(t) = 5
\]
is an equilibrium solution.
**Interpretation**
All nearby solutions move toward \(I=5\). This represents stable equilibrium behavior.
:::
---
### Euler’s Method
Euler’s method is a numerical algorithm for approximating solutions of:
\[
y' = F(x,y), \qquad y(x_0)=y_0
\]
Instead of solving exactly, we approximate step-by-step using tangent lines.
<div class="note">
**Euler’s Method Formula**
Let step size be \(h\). Define points:
\[
x_n = x_0 + nh
\]
Then the recursion formula is:
\[
y_{n} = y_{n-1} + h\,F(x_{n-1}, y_{n-1})
\]
</div>
This means:
> New value = old value + (step size × slope)
::: {.example}
Euler Approximation
Approximate $y$ near $x = 0.5$ given
\[
y' = x + y, \qquad y(0)=1, \qquad h=0.1
\]
So:
\[
F(x,y) = x+y.
\]
**Step 1:**
\[
y_1 = 1 + 0.1(0+1) = 1.1
\]
**Step 2:**
\[
y_2 = 1.1 + 0.1(0.1+1.1) = 1.22
\]
**Step 3:**
\[
y_3 = 1.22 + 0.1(0.2+1.22) = 1.362
\]
**Table**
| \(n\) | \(x_n\) | \(y_n\) |
|------|--------|--------|
| 0 | 0.0 | 1.0000 |
| 1 | 0.1 | 1.1000 |
| 2 | 0.2 | 1.2200 |
| 3 | 0.3 | 1.3620 |
| 4 | 0.4 | 1.5282 |
| 5 | 0.5 | 1.7210 |
So,
\[
y(0.5) \approx 1.721
\]
:::
**Accuracy and Step Size**
- Smaller \(h\) → better accuracy
- Larger \(h\) → faster computation, lower accuracy
- As \(h \to 0\), Euler’s method approaches the true solution
Euler’s method is the foundation of modern numerical solvers used in scientific computing.
---
### Putting It All Together
> Differential equations describe change. Direction fields show **how change behaves**. Euler’s method shows **how change accumulates**.
Together, they provide a complete framework for understanding systems when exact solutions are impossible.
#### Conceptual Takeaways
- Most differential equations **cannot be solved explicitly**
- Direction fields show **global behavior** of solutions
- Euler’s method gives **local numerical approximations**
- Direction fields → qualitative understanding
- Euler’s method → quantitative approximation
- Equilibrium solutions model **steady states**
- Autonomous equations exhibit **horizontal shift symmetry**
---
#### Skills You Should Be Able to Do
After this section, you should be able to:
**Direction Fields**
- Interpret \(y' = F(x,y)\) as a slope rule
- Construct and read direction fields
- Sketch solution curves using slope fields
- Identify equilibrium solutions
- Predict long-term behavior from direction fields
**Euler’s Method**
- Apply the Euler update formula
- Build numerical solution tables
- Approximate \(y(x)\) values
- Understand the effect of step size \(h\)
- Interpret numerical solutions physically
---
#### Problems
## Separable Equations
So far, we have studied differential equations using:
- **Geometric methods** → direction fields
- **Numerical methods** → Euler’s method
These approaches help us visualize and approximate solutions. However, in some special cases, we can go further and find explicit symbolic formulas for solutions. One of the most important solvable classes is the class of **separable differential equations**.
<div class="definition">
A first-order differential equation is called **separable** if it can be written in the form
\[
\frac{dy}{dx} = t(x)\,f(y)
\]
</div>
That is, the right-hand side of a separable DE factors into:
- a function of \(x\) only, and
- a function of \(y\) only.
If the equation is separable, we can rewrite it as
\[
h(y)\,dy = t(x)\,dx
\]
so that:
- all \(y\)-terms are on one side,
- all \(x\)-terms are on the other side.
Then we integrate:
\[
\int h(y)\,dy = \int t(x)\,dx
\]
This produces an **implicit solution**. Sometimes we can solve explicitly for \(y\); sometimes we cannot.
<div class="definition">
**Solving a Separable Equation**
**Step 1:** Write the equation in differential form
\[
\frac{dy}{dx} = t(x)f(y)
\]
**Step 2:** Separate variables
\[
\frac{1}{f(y)}\,dy = t(x)\,dx
\]
**Step 3:** Integrate both sides
\[
\int \frac{1}{f(y)}\,dy = \int t(x)\,dx
\]
**Step 4:** Add constant of integration \(C\)
**Step 5:** (If possible) solve explicitly for \(y\)
</div>
::: {.example}
Basic Separable Equation
Solve
\[
\frac{dy}{dx} = \frac{x^2}{y^2}, \qquad y(0)=2
\]
**Solution:**
**Step 1: Separate variables**
\[
y^2\,dy = x^2\,dx
\]
**Step 2: Integrate**
\[
\int y^2\,dy = \int x^2\,dx
\]
\[
\frac{1}{3}y^3 = \frac{1}{3}x^3 + C
\]
**Step 3: Solve for \(y\)**
\[
y^3 = x^3 + K
\]
\[
y = \sqrt[3]{x^3 + K}
\]
**Step 4: Apply initial condition \(y(0)=2\)**
\[
2 = \sqrt[3]{K} \Rightarrow K=8
\]
**Final Solution**
\[
y = \sqrt[3]{x^3 + 8}
\]
:::
::: {.example}
Implicit Solution
Solve
\[
\frac{dy}{dx} = \frac{6x^2}{2y+\cos y}
\]
**Solution:**
**Separation**
\[
(2y+\cos y)\,dy = 6x^2\,dx
\]
**Integration**
\[
\int (2y+\cos y)\,dy = \int 6x^2\,dx
\]
\[
y^2 + \sin y = 2x^3 + C
\]
**Result (Implicit Solution)**
\[
y^2 + \sin y = 2x^3 + C
\]
> This equation cannot be solved explicitly for \(y\), but it still defines the solution curve.
:::
::: {.example}
Exponential Growth/Decay Structure
Solve
\[
y' = x^2 y
\]
**Solution:**
**Separation**
\[
\frac{1}{y}\,dy = x^2\,dx
\]
**Integration**
\[
\ln|y| = \frac{x^3}{3} + C
\]
**Solve for \(y\)**
\[
y = Ae^{x^3/3}
\]
**General Solution**
\[
y = Ae^{x^3/3}
\]
:::
---
### Physical Application Example
::: {.example}
Electric Circuit Model
Solve
\[
\frac{dI}{dt} = 15 - 3I, \qquad I(0)=0
\]
**Solution:**
**Separation**
\[
\frac{dI}{15-3I} = dt
\]
**Integration**
\[
-\frac{1}{3}\ln|15-3I| = t + C
\]
**Solve for \(I(t)\)**
\[
I(t) = 5 - 5e^{-3t}
\]
**Limiting Value**
\[
\lim_{t\to\infty} I(t) = 5
\]
**Interpretation**
The current increases over time and approaches a **steady-state equilibrium** of **5 amperes**.
:::
---
### Putting It All Together
> Direction fields show **how solutions behave**. Euler’s method shows **how solutions accumulate**. Separable equations show **why solutions exist symbolically**
Together, these form the three core perspectives of differential equations: geometric, numerical, and analytic.
#### Conceptual Takeaways
- Some differential equations can be solved **symbolically**
- Separable equations allow **exact analytic solutions**
- The key structure is:
\[
y' = t(x)f(y)
\]
- Separation transforms differential equations into **integral equations**
- Solutions may be:
- explicit (\(y=f(x)\)), or
- implicit (\(F(x,y)=C\))
- Equilibrium values arise naturally in separable models
- Many physical systems are separable:
- population models
- cooling laws
- circuits
- mixing problems
- drug concentration models
---
#### Skills You Should Be Able To Do
After this section, you should be able to:
- Recognize when a differential equation is separable
- Factor equations into \(t(x)f(y)\) form
- Separate variables correctly
- Integrate both sides
- Apply constants of integration properly
- Solve for \(y\) when possible
- Work with implicit solutions
- Solve initial-value problems
- Interpret equilibrium behavior
- Model real systems symbolically
- Connect direction fields to analytic solutions
- Understand limiting behavior (\(t \to \infty\))
---
#### Problems
## Models for Population Growth
Population growth is one of the most important real-world applications of differential equations. In this section, we develop mathematical models that describe how populations change over time, starting with simple exponential growth and progressing to more realistic models that incorporate environmental limits and resource constraints.
We focus on two core models:
- **The Law of Natural Growth (Exponential Growth Model)**
- **The Logistic Growth Model**
These models help us understand how assumptions about resources, space, and environment shape long-term population behavior.
---
### The Law of Natural Growth (Exponential Model)
The law of natural growth assumes that:
> The rate of change of the population is proportional to the size of the population.
Mathematically, this is written as:
\[
\frac{dP}{dt} = kP
\]
where:
- \( P(t) \) = population size at time \( t \)
- \( k \) = growth constant
- \( k > 0 \): population increases
- \( k < 0 \): population decreases
This means larger populations grow faster, and smaller populations grow more slowly, but the *relative growth rate* remains constant.
This differential equation is separable and solves to:
\[
P(t) = P_0 e^{kt}
\]
where:
- \( P_0 = P(0) \) is the initial population.
This model produces **exponential growth** (or decay).
**Interpretation**
\[
\frac{1}{P}\frac{dP}{dt} = k
\]
This shows that the relative growth rate (growth per individual) is constant. So exponential growth occurs when each individual contributes equally and independently to growth, and resources are unlimited.
::: {.example}
Exponential Growth
A bacterial population grows according to:
\[
\frac{dP}{dt} = 0.3P, \qquad P(0) = 500.
\]
Find the population function and the population after 5 hours.
**Solution**
\[
P(t) = 500e^{0.3t}
\]
At \( t = 5 \):
\[
P(5) = 500e^{1.5} \approx 2240
\]
:::
Exponential growth assumes:
- unlimited resources
- unlimited space
- no competition
- no environmental constraints
This makes it realistic only for short-term growth or early population stages.
---
### The Logistic Growth Model
Real populations do not grow exponentially forever. As populations increase:
- resources become limited
- competition increases
- growth slows
- populations stabilize
To model this, we introduce a **carrying capacity**.
\[
\frac{dP}{dt} = kP\left(1 - \frac{P}{M}\right)
\]
where:
- \( M \) = carrying capacity (maximum sustainable population)
- \( k \) = intrinsic growth rate
**Interpretation:**
- If \( P \ll M \):
\[
\frac{dP}{dt} \approx kP
\]
→ growth is approximately exponential.
- If \( P \to M \):
\[
\frac{dP}{dt} \to 0
\]
→ growth slows and stabilizes.
- If \( P > M \):
\[
\frac{dP}{dt} < 0
\]
→ population decreases.
The logistic equation has two equilibrium populations:
\[
P = 0 \quad \text{and} \quad P = M
\]
- \( P = 0 \): unstable equilibrium
- \( P = M \): stable equilibrium (carrying capacity)
The solution to the logistic differential equation is:
\[
P(t) = \frac{M}{1 + Ae^{-kt}},
\]
where:
\[
A = \frac{M - P_0}{P_0}
\]
and \( P_0 = P(0) \).
::: {.example}
Logistic Growth
Solve
\[