dydx

Ordinary Differential Equations

Your Progress in this Chapter

0%

0 / 21 units completed

Chapter Overview

Higher Order Differential Equations

Section 8.3 of 722 min7 code examples

Introduction

A higher‑order differential equation involves derivatives of order two or higher. Many physical systems such as oscillations, mechanical vibrations, and electrical circuits are naturally modeled by second‑order or higher‑order equations.

Examples:

  • Simple harmonic oscillator (second order)
  • Damped oscillator
  • Forced oscillator
  • Beam deflection problems
  • RLC electrical circuits

To use SepalSolver to solve higher‑order ODEs, they have to first be converted into equivalent systems of first‑order equations.

General Form

A general n‑th order ODE can be written as:

dnydtn=f(t,y,y,y,,y(n1))\cfrac{d^n y}{dt^n} = f(t, y, y', y'', \dots, y^{(n-1)})

To solve with SepalSolver, we introduce variables:

y1=y,  y2=y,  y3=y,  ,  yn=y(n1)y_1 = y,\; y_2 = y',\; y_3 = y'',\;\dots,\; y_n = y^{(n-1)}

Then the system becomes:

y1=y2y2=y3yn=f(t,y1,y2,,yn)\begin{array}{c} y_1' = y_2 \\ y_2' = y_3 \\ \vdots \\ y_n' = f(t, y_1, y_2, \dots, y_n) \end{array}

Example 1C#

1
2
Code is ready to run

Examples

Here are examples of converting and solving various higher‑order ODEs using SepalSolver.

.. Admonition:: Example 1 : Simple Harmonic Oscillator (Second Order)

| Equation: y'' + y = 0, | Converted system:

\begin{eqnarray} y_1' &= y_2 \\ y_2' &= -y_1 \end{eqnarray}

Example 2C#

1
2
3
4
5
6
7
8
Code is ready to run
OutputFrom the book
HigherOrder_SHO.png

.. Admonition:: Example 2 : Damped Oscillator

| Equation: y'' + 2β y' + ω^2 y = 0, | Converted system:

\begin{eqnarray} y_1' &= y_2 \\ y_2' &= -2β y_2 - ω^2 y_1 \end{eqnarray}

Example 3C#

1
2
3
4
5
6
7
8
9
Code is ready to run
OutputFrom the book
HigherOrder_Damped.png

.. Admonition:: Example 3 : Forced Oscillator

| Equation: y'' + y = cos(t), | Converted system:

\begin{eqnarray} y_1' &= y_2 \\ y_2' &= -y_1 + \cos(t) \end{eqnarray}

Example 4C#

1
2
3
4
5
6
7
8
Code is ready to run
OutputFrom the book
HigherOrder_Forced.png

.. Admonition:: Example 4 : RLC Circuit

| Equation: L i'' + R i' + (1/C) i = 0, | Converted system:

\begin{eqnarray} i_1' &= i_2 \\ i_2' &= -(R/L) i_2 - (1/(L C)) i_1 \end{eqnarray}

Example 5C#

1
2
3
4
5
6
7
8
9
Code is ready to run
OutputFrom the book
HigherOrder_RLC.png

.. Admonition:: Example 5 : Third‑Order Example

| Equation: y''' - y = 0, | Converted system:

\begin{eqnarray} y_1' &= y_2 \\ y_2' &= y_3 \\ y_3' &= y_1 \end{eqnarray}

Example 6C#

1
2
3
4
5
6
7
8
Code is ready to run
OutputFrom the book
HigherOrder_Third.png

.. Admonition:: Example 6 : Pleiades System (Using Higher Order Solvers)

The Pleiades, also known as the Seven Sisters(M45)[1], is a prominent open star cluster located in the constellation Taurus.It's one of the closest and most easily visible star clusters to Earth[2], making it a favorite target for stargazers and a subject of fascination across cultures. The system of equations describing the motion of the stars in the cluster consists of 14 nonstiff second-order differential equations, which produce a system of 28 equations when rewritten in first-order form.

Celestial mechanics is basically an interplay between

Newton's law of gravitation: F_i = \sum_{i \neq j} g \cfrac{m_i m_j}{||p_j - p_i||^2}d_{ij} and

Newton's second law of motion: F_i = m_i\cfrac{ d^2p_i}{ dt^2}.

The positions determine the gravitational forces acting on the bodies, but the net force on each of the bodies determines its acceleration(i.e.changes its position from the second order).

we examine this system in 2D, i.e. p_i = [x_i, y_i], d_{ij} = \cfrac{(p_j - p_i)}{r_{ ij}} and r_{ij} = ||p_j - p_i||

The dynamics of the system can then be modelled as:

d2pidt2=ijgmj(pjpi)rij3\cfrac{ d^2p_i}{ dt^2} = \sum_{ i \neq j}g \cfrac{ m_j(p_j - p_i)}{ r_{ ij} ^3}

Example 7C#

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
Code is ready to run
OutputFrom the book
Position-of-Pleiades-Stars-Ode89.png