Damped simple harmonic oscillator, phase space I want to calculate and draw the phase space trajectory of this damped harmonic oscillator:
$$\ddot{x}+\gamma\,\dot{x}+\omega^2x=0$$
for the two cases $\gamma=2\omega$ and $\gamma=\omega$.
I'm really stuck with this and have no idea what to do... I've found stuff on google about it but am struggling to follow.
 A: The standard approach to these problems is to introduce $y = \dot{x}$ and kinda regard $y$ as an independent variable. Upon introduction of $y$, you acquire the following system
\begin{align*}
\frac{\mathrm{d}}{\mathrm{d} t} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 0 & 1 \\ - \omega^2 & - \gamma \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix}
\end{align*}
You solve this by finding the eigenvalues and eigenvectors of the matrix. Assuming that we can find $2$ eigenvectors $v_1,v_2$ with eigenvalues $\lambda_1,\lambda_2$, the solution is given by
\begin{align*}
\begin{pmatrix} x \\ y \end{pmatrix} = c_1 v_1 \mathrm{e}^{\lambda_1 t} + c_2 v_2 \mathrm{e}^{\lambda_2 t}
\end{align*}
where $c_1$ and $c_2$ follow from the initial condition(s). To draw the phase space trajectory, simply plot $y$ vs $x$ for all $t$.
Now, the problem gets more complicated when the matrix does not have $2$ eigenvectors. If it has only one eigenvector $v_1$ with eigenvalue $\lambda_1$, you look for a second solution of the form $c_2(t) v_1 \mathrm{e}^{\lambda_1 t}$ with $c_2$ a function of $t$.
A: A quick orientation can be gotten by using a WolframAlpha query.
In your case:
solve x'' + 2 w x' + w^2 x = 0 (link)
and
solve x'' + w x' + w^2 x = 0 (link)
It will give you algebraic solutions, which you could use for your $(x, \dot{x})$ plot with other software (mathematica example) (octave example).
And it provides some sample plots for some initial conditions it chooses which might give you an idea what is going on.
