Solution 1
This solution involves trigonometric substitutions (derivation made by Rigel Melaan).
Express instantaneous velocity as the derivative of position with respect to time:
\(v(t)=\lim _{\Delta t \rightarrow 0} \frac{\Delta s}{\Delta t}=\frac{d s}{d t}\)
Rearrange the equation and introduce the v-t model:
\(s(t)=\int v d t=\)
\(\int \sqrt{\frac{m g}{k}} \tanh \left(\operatorname{arctanh}\left(v_0 \sqrt{\frac{k}{m g}}\right)-t \sqrt{\frac{k g}{m}}\right) d t\)
Factor out the constants:
\(s(t)=\sqrt{\frac{m g}{k}} \int \tanh \left(\operatorname{arctanh}\left(v_0 \sqrt{\frac{k}{m g}}\right)-t \sqrt{\frac{k g}{m}}\right) d t\)
Introduce variables \(u\) and \(du\):
\(u=\operatorname{arctanh}\left(v_0 \sqrt{\frac{k}{m g}}\right)-t \sqrt{\frac{k g}{m}}\)
\(\frac{d u}{d t}=-\sqrt{\frac{k g}{m}} \Longrightarrow d t=-\sqrt{\frac{m}{k g}} d u\)
Substitute \(u\) and \(du\) and simplify:
\(s(t)=\sqrt{\frac{m g}{k}} \int \tanh (u) \times-\sqrt{\frac{m}{k g}} d u\)
\(s(t)=-\frac{m}{k} \int \tanh (u) d u\)
Define \(v\) and \(dv\):
\(v=\cosh (u)\)
\(\frac{d v}{d u}=\sinh u \Longrightarrow d u=\frac{1}{\sinh u} \times d v\)
Use identity of \(\sinh\) and substitute:
\(s(t)=-\frac{m}{k} \int \frac{\sinh u}{v} \frac{1}{\sinh u} d v=\)
\(-\frac{m}{k} \int \frac{1}{v} d v=-\frac{m}{k} \ln |v|+c\)
Substitute \(u\) back to the model. At time \(t=0\), \(c\) is \(s_0\):
\(s(t)=s_0-\frac{m \ln \left(\cosh \left(\operatorname{arctanh}\left(v_0 \sqrt{\frac{k}{m g}}\right)-t \sqrt{\frac{k g}{m}}\right)\right)}{k}\)