70.14.3 problem 31

Internal problem ID [18928]
Book : Differential equations. An introduction to modern methods and applications. James Brannan, William E. Boyce. Third edition. Wiley 2015
Section : Chapter 4. Second order linear equations. Section 4.4 (Mechanical and electrical vibration). Problems at page 250
Problem number : 31
Date solved : Thursday, October 02, 2025 at 03:33:02 PM
CAS classification : [[_2nd_order, _missing_x]]

\begin{align*} m y^{\prime \prime }+k y&=0 \end{align*}

With initial conditions

\begin{align*} y \left (0\right )&=a \\ y^{\prime }\left (0\right )&=b \\ \end{align*}
Maple. Time used: 0.067 (sec). Leaf size: 37
ode:=m*diff(diff(y(x),x),x)+k*y(x) = 0; 
ic:=[y(0) = a, D(y)(0) = b]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = \frac {b \sqrt {m}\, \sin \left (\frac {\sqrt {k}\, x}{\sqrt {m}}\right )+a \cos \left (\frac {\sqrt {k}\, x}{\sqrt {m}}\right ) \sqrt {k}}{\sqrt {k}} \]
Mathematica. Time used: 0.012 (sec). Leaf size: 46
ode=m*D[y[x],{x,2}]+k*y[x]==0; 
ic={y[0]==a,Derivative[1][y][0] ==b}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to a \cos \left (\frac {\sqrt {k} x}{\sqrt {m}}\right )+\frac {b \sqrt {m} \sin \left (\frac {\sqrt {k} x}{\sqrt {m}}\right )}{\sqrt {k}} \end{align*}
Sympy. Time used: 0.067 (sec). Leaf size: 70
from sympy import * 
x = symbols("x") 
k = symbols("k") 
m = symbols("m") 
y = Function("y") 
ode = Eq(k*y(x) + m*Derivative(y(x), (x, 2)),0) 
ics = {y(0): a, Subs(Derivative(y(x), x), x, 0): b} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {\left (a \sqrt {- \frac {k}{m}} - b\right ) e^{- x \sqrt {- \frac {k}{m}}}}{2 \sqrt {- \frac {k}{m}}} + \frac {\left (a \sqrt {- \frac {k}{m}} + b\right ) e^{x \sqrt {- \frac {k}{m}}}}{2 \sqrt {- \frac {k}{m}}} \]