3.1. Analytical Solutions to 2nd-order ODEs#
Let’s first focus on simple analytical solutions for 2nd-order ODEs. As before, let’s categorize problems based on their solution approach.
# import libraries for numerical functions and plotting
import numpy as np
import matplotlib.pyplot as plt
# these lines are only for helping improve the display
import matplotlib_inline.backend_inline
matplotlib_inline.backend_inline.set_matplotlib_formats('pdf', 'png')
plt.rcParams['figure.dpi']= 300
plt.rcParams['savefig.dpi'] = 300
3.1.1. Solution by direct integration#
If you have a 2nd-order ODE of this form:
then you can solve by direct integration.
For example, let’s say we are trying to solve for the deflection of a cantilever beam
That is our general solution; we can obtain the specific solution by applying our two initial conditions:
3.1.2. Solution by substitution#
If we have a 2nd-order ODE of this form:
then we can solve by substitution, meaning by substituting a new variable for
Let’s substitute
Now we have a 1st-order ODE! Then, we can apply the methods previously discussed to solve this; once we find
3.1.2.1. Example: falling object#
For example, consider a falling mass where we are solving for the downward distance as a function of time,
where
Then, we can solve this for
and apply our initial condition for position,
Here is the full process:
Applying the initial condition for velocity,
Then, to get
Finally, we can apply the initial condition for position,
3.1.2.2. Example: catenary problem#
The catenary problem describes the shape of a hanging chain or rope fixed between two points. (It was also a favorite of one of my professors, Joe Prahl, and I like to teach it as an example in his honor.) The downward displacement of the hanging string/chain/rope as a function of horizontal position,
This is actually a boundary value problem, with the boundary conditions for the displacement at one side
We can solve this via substitution, by letting a new variable
Then, we can integrate once again to get
This is the general solution to the catenary problem, and applies to any boundary conditions.
For our specific case, we can apply the boundary conditions and find the particular solution, though it involves some algebra…:
So, the overall solution for the catenary problem with the given boundary conditions is
Let’s see what this looks like:
length = 1.0
x = np.linspace(0, 1)
y = np.cosh(x - length/2) - np.cosh(length/2)
plt.plot(x, y)
plt.grid(True)
plt.show()

Please note that I’ve made some simplifications in the above work, and skipped the details of how the ODE is derived. In general, the solution for the shape is
where you would solve for the constants
where
You can read more about the catenary problem here (for example): http://euclid.trentu.ca/aejm/V4N1/Chatterjee.V4N1.pdf
3.1.3. Homogeneous 2nd-order ODEs#
An important category of 2nd-order ODEs are those that look like
“Homogeneous” means that the ODE is unforced; that is, the right-hand side is zero.
Depending on what
constant coefficients:
Euler-Cauchy equations:
Series solutions
First, let’s talk about the characteristics of linear, homogeneous 2nd-order ODEs:
3.1.3.1. Solutions have two parts:#
Solutions have two parts:
3.1.3.2. Linearly independent:#
The two parts of the solution
One way of defining this is that
Another way of thinking about this is that
3.1.3.3. Both parts satisfy the ODE:#
However, we need both parts together to fully solve the ODE.
3.1.3.4. Reduction of order:#
If
Now, we have an ODE with only
So, the actual solution procedure is then:
Solve for
:Solve for
:Get
:
Here’s an example, where we know one part of the solution
Then, the general solution to the ODE is