33.5.8 problem Problem 24.30

Internal problem ID [7837]
Book : Schaums Outline Differential Equations, 4th edition. Bronson and Costa. McGraw Hill 2014
Section : Chapter 24. Solutions of linear DE by Laplace transforms. Supplementary Problems. page 248
Problem number : Problem 24.30
Date solved : Tuesday, September 30, 2025 at 05:06:10 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Using Laplace method With initial conditions

\begin{align*} y \left (0\right )&=0 \\ y^{\prime }\left (0\right )&=2 \\ \end{align*}
Maple. Time used: 0.112 (sec). Leaf size: 14
ode:=diff(diff(y(x),x),x)+y(x) = sin(x); 
ic:=[y(0) = 0, D(y)(0) = 2]; 
dsolve([ode,op(ic)],y(x),method='laplace');
 
\[ y = \frac {5 \sin \left (x \right )}{2}-\frac {\cos \left (x \right ) x}{2} \]
Mathematica. Time used: 0.015 (sec). Leaf size: 55
ode=D[y[x],{x,2}]+y[x]==Sin[x]; 
ic={y[0]==0,Derivative[1][y][0] ==2}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\cos (x) \int _1^0-\sin ^2(K[1])dK[1]+\cos (x) \int _1^x-\sin ^2(K[1])dK[1]+\frac {19 \sin (x)}{8}-\frac {1}{8} \sin (3 x) \end{align*}
Sympy. Time used: 0.061 (sec). Leaf size: 15
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) - sin(x) + Derivative(y(x), (x, 2)),0) 
ics = {y(0): 0, Subs(Derivative(y(x), x), x, 0): 2} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = - \frac {x \cos {\left (x \right )}}{2} + \frac {5 \sin {\left (x \right )}}{2} \]