72.16.26 problem 27

Internal problem ID [14843]
Book : DIFFERENTIAL EQUATIONS by Paul Blanchard, Robert L. Devaney, Glen R. Hall. 4th edition. Brooks/Cole. Boston, USA. 2012
Section : Chapter 4. Forcing and Resonance. Section 4.1 page 399
Problem number : 27
Date solved : Thursday, March 13, 2025 at 04:21:24 AM
CAS classification : [[_2nd_order, _missing_x]]

\begin{align*} y^{\prime \prime }+2 y&=-3 \end{align*}

With initial conditions

\begin{align*} y \left (0\right )&=0\\ y^{\prime }\left (0\right )&=0 \end{align*}

Maple. Time used: 0.019 (sec). Leaf size: 14
ode:=diff(diff(y(t),t),t)+2*y(t) = -3; 
ic:=y(0) = 0, D(y)(0) = 0; 
dsolve([ode,ic],y(t), singsol=all);
 
\[ y = -\frac {3}{2}+\frac {3 \cos \left (\sqrt {2}\, t \right )}{2} \]
Mathematica. Time used: 0.015 (sec). Leaf size: 17
ode=D[y[t],{t,2}]+2*y[t]==-3; 
ic={y[0]==0,Derivative[1][y][0] ==0}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\[ y(t)\to -3 \sin ^2\left (\frac {t}{\sqrt {2}}\right ) \]
Sympy. Time used: 0.083 (sec). Leaf size: 17
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(2*y(t) + Derivative(y(t), (t, 2)) + 3,0) 
ics = {y(0): 0, Subs(Derivative(y(t), t), t, 0): 0} 
dsolve(ode,func=y(t),ics=ics)
 
\[ y{\left (t \right )} = \frac {3 \cos {\left (\sqrt {2} t \right )}}{2} - \frac {3}{2} \]