40.11.7 problem 32

Internal problem ID [6741]
Book : Schaums Outline. Theory and problems of Differential Equations, 1st edition. Frank Ayres. McGraw Hill 1952
Section : Chapter 16. Linear equations with constant coefficients (Short methods). Supplemetary problems. Page 107
Problem number : 32
Date solved : Sunday, March 30, 2025 at 11:21:07 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+5 y&=\cos \left (\sqrt {5}\, x \right ) \end{align*}

Maple. Time used: 0.004 (sec). Leaf size: 35
ode:=diff(diff(y(x),x),x)+5*y(x) = cos(x*5^(1/2)); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (10 c_1 +1\right ) \cos \left (\sqrt {5}\, x \right )}{10}+\frac {\sin \left (\sqrt {5}\, x \right ) \left (\sqrt {5}\, x +10 c_2 \right )}{10} \]
Mathematica. Time used: 0.156 (sec). Leaf size: 45
ode=D[y[x],{x,2}]+5*y[x]==Cos[Sqrt[5]*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \left (\frac {1}{20}+c_1\right ) \cos \left (\sqrt {5} x\right )+\frac {1}{10} \left (\sqrt {5} x+10 c_2\right ) \sin \left (\sqrt {5} x\right ) \]
Sympy. Time used: 0.136 (sec). Leaf size: 31
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(5*y(x) - cos(sqrt(5)*x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} \cos {\left (\sqrt {5} x \right )} + \left (C_{1} + \frac {\sqrt {5} x}{10}\right ) \sin {\left (\sqrt {5} x \right )} \]