The second order Linear Differential Equations can be solved using DifferentialEquations.jl package available in Julia repository. Here is an example problem being solved using Julia.
Consider a 4-degree of freedom undamped free vibration system as follows.

The above system can be represented by the equation,
$$ \displaystyle{[M] [\ddot{x}] + [K][x] = 0} $$
where,
Let’s take the following values and initial conditions for this problem.
| |
The above differential equation can be re-arranged as,
where, $\displaystyle{[B] = -[M]^{-1}[K]}$.
Now, to solve the equation $\displaystyle{\ddot{x} = Bx}$, the following code is run in julia.
| |
Some key points to note are,
- The solution is arrived as three steps.
- Define the differential equation
f. - Define the problem by specifying function, initial conditions and time span.
- Solving the defined problem.
- Define the differential equation
tspanis the variable which specifies the range over which we are solving for $x$.- The function
fis equated to second derivative $\ddot x$ here. Generally,fis a function of,du- The derivative ofuu- The variable being solvedp- parameter for parameterized functionst- time
- The function
SecondOrderODEProblemtakes in the functionf, initial conditionsdu0($\dot x_0$ here) and u0 ($x_0$ here), and the time spantspan. solvegenerates dataset containing 9 columns - timestamp, $\displaystyle{\dot x_1, \dot x_2, \dot x_3, \dot x_4, x_1, x_2, x_3, x_4}$
The response (displacement) of the above system can be plotted as follows.
| |

This is a post I’ve made as part of my learning experience. Let me know if you have any feedback.