# Solving a second order differential equation numerically, by making it dimensionless

$$\textbf{I have been given the following:}$$

This is an example solution of a second order ODE, specifically that of a Harmonic Oscillator $${\text{d}v\over\text{d}t}=-\omega^2x-kv,$$ where $v=$d$x/$d$t$ and $\omega$ & $k$ are constants.

We can make this dimensionless by putting $x=x_0X$, $v=(x_0/t_0)V$ and $k=K/t_0$ where $\omega t_0=1$. The equation then becomes $${\text{d}V\over\text{d}T}=-X-KV.$$

To solve numerically, we need to convert this to a pair of 1st-order equations by using a vector of variables $Z=(X,V)$: \begin{align} {\text{d}X\over\text{d}T} &= V;\\ {\text{d}V\over\text{d}T} &= -X-KV. \end{align}

We'll look for solutions with $K=0,0.5,1$, initial conditions $(X_0,V_0)=(1.0,0.3)$, and we'll plot the solution to $T=4\pi$.

$$\textbf{My problem}$$
I understand how to solve the differential equation numerically, once it is in the form of two 1st-order equations. My problem is with making the differential equation dimensionless:

• Why do we want to make it dimensionless, is there not a way to convert into first order DEs without doing so?
• I don't entirely understand what the X,V,K terms are. I am assuming that we can say $x$ is some function, X multiplied by the initial condition $x_0$, as in this case the initial condition would be the only part with dimensionality. However I am not convinced with my interpretation, if anyone could provide some insight for this, that'd be great.
• Finally, upon making it dimensionless, how is it converted into the two First order DEs, it is mainly where $\frac{dX}{dT}$ comes from that is confusing me.

Any help is greatly appreciated, Thanks

Why do we want to make it dimensionless

You do not have to make it dimensionless. Making it dimensionless tends to make the various terms have similar magnitude, which reduces numerical errors, but is not strictly necessary.

I am assuming that we can say $x$ is some function, $X$ multiplied by the initial condition $x_0$

Yes. Your unknown function $x(t)$ is dimensional, presumably having dimension length, so you define $X=x/x_0$ such that you now have an alternative unknown function $X(t)$ which is dimensionless.

it is mainly where $dX/dT$ comes from that is confusing me.

You yourself wrote $v=dx/dt$. That's where it comes from. Instead of stating that the second derivative of the position equals something, you state that the first derivative of the speed equals something. Additionally, you define the speed as the first derivative of the position. So your second-order differential equation became two first-order differential equations.

• If i were to make the following dimensionless: $$\frac{dv}{dt}=-g\frac{dh}{dx}-kv^2,$$ where g is the acceleration due to gravity, v is speed, h is the height of a slope, x is the distance along the slope: $$h(x)=h_0-sx \text{ for } x\leq \frac{h_0}{s},$$ $$h(x)=0 \text{ for } x>\frac{h_0}{s}.$$ I am thinking that, as before: $x=x_0X$, $v^2=\left(\frac{x_0^2}{t_0^2}\right)V^2$, I have been told to take a unit of length $h_0=gt_0^2,$ I am completely lost as to what to do with the h derivative, also for k, I am again assuming that it is the same as the previous example: $k=\frac{K}{t_0}$, – George Apr 4 '18 at 13:30
• If you could provide some insight for how to make the h term dimensionless that'd be great – George Apr 4 '18 at 13:31
• Probably $h=h_0 H$. – Wouter Apr 4 '18 at 13:41