15.14.5 problem 5

Internal problem ID [3177]
Book : Differential Equations by Alfred L. Nelson, Karl W. Folley, Max Coral. 3rd ed. DC heath. Boston. 1964
Section : Exercise 23, page 106
Problem number : 5
Date solved : Sunday, March 30, 2025 at 01:20:29 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.003 (sec). Leaf size: 23
ode:=diff(diff(y(x),x),x)+2*y(x) = sin(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (\sqrt {2}\, x \right ) c_2 +\cos \left (\sqrt {2}\, x \right ) c_1 +\sin \left (x \right ) \]
Mathematica. Time used: 0.201 (sec). Leaf size: 30
ode=D[y[x],{x,2}]+2*y[x]==Sin[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \sin (x)+c_1 \cos \left (\sqrt {2} x\right )+c_2 \sin \left (\sqrt {2} x\right ) \]
Sympy. Time used: 0.065 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(2*y(x) - sin(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (\sqrt {2} x \right )} + C_{2} \cos {\left (\sqrt {2} x \right )} + \sin {\left (x \right )} \]