## Differential Equations - Simple spring model

There are usually more than one options how to get solve a problem. It is particularly true for math. Let's look on a spring and its mathematical model.

There are many sites describing how to get model of a spring. We will use one of the simplest:

\begin{aligned} \ddot{x} = - \frac{k}{m} * x \qquad (1) \end{aligned}

Let:

k = 2 (spring constant)
m = 1 (we can say that we assume unit mass)

So our differential equation is:

\begin{aligned} \ddot{x} = -2x \qquad (2) \end{aligned}

Let's solve the equation (2), that is let's find x(t) (x function of time) that satisfies the eq. (2).

Option 1

We may guess that x(t) must be something special that does not change much when derivated. $e^t$ is the case:

\begin{aligned} \frac{d}{dt}e^t = e^t \qquad (3) \end{aligned}

Then we can write:

\begin{aligned} x(t) = e^{ht} * w \qquad (4) \end{aligned}

where w - initial condition/constant

\begin{aligned} \dot{x(t)} = h * e^{ht} * w \qquad (5) \end{aligned}

\begin{aligned} \ddot{x(t)} = h^2 * e^{ht} * w \qquad (6) \end{aligned}

Now we can plug (4) and (6) into (2):

\begin{aligned} h^2 * e^{ht} * w = -2 * e^{ht} * w \qquad (7) \end{aligned}

Since $e^{ht} * w \neq 0$ we can divide both sides by that so we get:

\begin{aligned} h^2 = -2 \qquad (8) \end{aligned}

\begin{aligned} h = \pm \sqrt{-2} = \pm \sqrt{2} * j \qquad (9) \end{aligned}

Note:
h without j => overdumped system
h with j => underdamped system (with oscillations)

We got 2 following solutions:

\begin{aligned} x_{1_{(t)}} = e^{\sqrt{2}jt} * w \qquad (10) \end{aligned}

\begin{aligned} x_{2_{(t)}} = e^{-\sqrt{2}jt} * w \qquad (11) \end{aligned}

Now it is time for famous Euler's formula:

\begin{aligned} e^{i * something} = cos(something) + j * sin(something) \qquad (12) \end{aligned}

\begin{aligned} e^{-i * something} = cos(something) - j * sin(something) \qquad (13) \end{aligned}

Our 2 solutions can be written also as:

\begin{aligned} x_{1/2_{(t)}} = cos(\sqrt{2}t) \pm j * sin(\sqrt{2}t) * w \qquad (14) \end{aligned}

Let's use principle of Superposition - if I have 2 solutions, I can add/subtract them and scale them. So if we take 2 solutions from (14) and multiply both by 1/2 and add them we just get $cos(\sqrt{2}t) * w$. If we multiply both by -1/2j and subtract them, we get $sin(\sqrt{2}) * w$. These 2 terms combined give us general solution:

\begin{aligned} x_{t} = C_1 * cos(\sqrt{2}t) + C_2 * sin(\sqrt{2}t) \qquad (15) \end{aligned}

Another form of general solution would be:

\begin{aligned} x_{t} = C_1 * e^{\sqrt{2}jt} + C_2 * e^{-\sqrt{2}jt} \qquad (16) \end{aligned}

IVP (Initial Value Problem) v1:

We are given following values:

a/ $x_0 = 3$

b/ $\dot{x_0} = v_0 = 4$

And our goal is estimate C1, C2 constants, so we choose 1 particular solution from the general solution.

1. Let's use the first of peace of information which is, the initial position $x_0 = 3$. We can directly plug this into (15):

\begin{aligned} x_{t=0} = C_1 * cos(\sqrt{2}* 0) + C_2 * sin(\sqrt{2}* 0) = 3 \qquad \end{aligned}

\begin{aligned} C_1 * 1 + C_2 * 0 = 3 \qquad \end{aligned}

\begin{aligned} C_1 = 3 \qquad \end{aligned}

To get C2 we have to take derivative of the (15):

\begin{aligned} \frac{dx}{dt} = 4 = - C_1 * \sqrt{2} * sin(\sqrt{2}* 0) + C_2 * \sqrt{2} * cos(\sqrt{2}* 0) \qquad \end{aligned}

\begin{aligned} 4 = C_2 * \sqrt{2} * cos(0) \qquad \end{aligned}

\begin{aligned} 4/ \sqrt{2} = C_2 \qquad \end{aligned}

IVP (Initial Value Problem) v2:

We are given following values:

a/ $x_0 = 3$

b/ $\dot{x_0} = v_0 = 4$

Now we can plug $x_0 = 3$ into (16):

\begin{aligned} x_{t} = C_1 * e^{\sqrt{2} * j * 0} + C_2 * e^{-\sqrt{2} * j * 0} = 3 \qquad \end{aligned}

\begin{aligned} C_1 + C_2 = 3 \qquad \end{aligned}

\begin{aligned} C_1 = 3 - C_2 \qquad \end{aligned}

Now let's take derivative of (16):

\begin{aligned} \frac{dx}{dt} = 4 = \sqrt{2}j * C_1 * e^{\sqrt{2} * j * t} + \sqrt{2}j * C_2 * e^{-\sqrt{2} * j * t} \qquad \end{aligned}

\begin{aligned} \frac{dx}{dt} = 4 = \sqrt{2}j * C_1 - \sqrt{2}j * C_2 \qquad \end{aligned}

\begin{aligned} \frac{dx}{dt} = 4 = \sqrt{2}j * (3 - C_2) - \sqrt{2}j * C_2 \qquad \end{aligned}

\begin{aligned} \frac{dx}{dt} = 4 = \sqrt{2}j * 3 - C_2 *  \sqrt{2}j  - C_2 * \sqrt{2}j \qquad \end{aligned}

\begin{aligned}  4 = 3 * \sqrt{2}j - 2 * C_2 *  \sqrt{2}j  \qquad \end{aligned}

\begin{aligned} C_2 = \frac{ 3 * \sqrt{2}j -  4}{2 * \sqrt{2}j}  \qquad \end{aligned}

\begin{aligned} C_1 = 3 - \frac{ 3 * \sqrt{2}j -  4}{2 * \sqrt{2}j}  \qquad \end{aligned}

IVP (Initial Value Problem) v3 - Laplace transformation:

We are again given following values:

a/ $x_0 = 3$

b/ $\dot{x_0} = v_0 = 4$

Now we can try to use the Laplace transformation and verify our previous results. I found good explanation of the Laplace transformation here.

The first step is to take Laplace transform of the both sides.

We have to realize that x is function of t -> x(t). And $L\{x(t)\} = X(s) = X$.

\begin{aligned} L\{\ddot{x}\} = L\{-2x\} \qquad \end{aligned}

\begin{aligned} s^2X - sx(0) - \dot{x(0)} = -2X \qquad \end{aligned}

Now we have to solve for X and use our initial conditions.

\begin{aligned} s^2X - s*3 - 4 = -2X \qquad \end{aligned}

\begin{aligned} s^2X + 2X = 3s + 4 \qquad \end{aligned}

\begin{aligned} X * (s^2 + 2) = 3s + 4 \qquad \end{aligned}

\begin{aligned} X = \frac{3s + 4}{s^2 + 2} \qquad \end{aligned}

Now we have several options:

a/ Do partial fraction decomposition by hand - described here and here and take inverse Laplace transformation.

b/ Do partial fraction decomposition in Matlab/Octave - use command residue and take inverse Laplace transformation.

c/ Use online Laplace calculator (here or here) to compute inverse Laplace transformation of our term. In our case it would be - link.

Either way, the solution we get should be:

\begin{aligned} L^{-1}\{X\} = 3\cos \left(\sqrt{2}t\right)+\frac{4\sin \left(\sqrt{2}t\right)}{\sqrt{2}} \qquad \end{aligned}

0 #3 MatRoam 2018-07-14 16:00
Viagra Quel Cas Amoxicillin And Allergic And Reaction cialis online Rx List Symptoms Of Amoxicillin Overdose

+1 #2 www.health4U.sk 2015-07-20 01:41
Dobre napísané, hľadal som niečo podobného, a tu som to našiel, a
okrem toho som spokojný, lebo konečne niekto píše stručne a k veci.
Budem sledovať stránku

+1 #1 http://healthraport. 2015-07-16 19:23
Spracovaný veľmi prístupným spôsobom. Srdečne pozdravujem.