87.16.20 problem 20

Internal problem ID [23589]
Book : Ordinary differential equations with modern applications. Ladas, G. E. and Finizio, N. Wadsworth Publishing. California. 1978. ISBN 0-534-00552-7. QA372.F56
Section : Chapter 2. Linear differential equations. Exercise at page 119
Problem number : 20
Date solved : Thursday, October 02, 2025 at 09:43:15 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-3 y&=\cos \left (x \right ) \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 26
ode:=diff(diff(y(x),x),x)-3*y(x) = cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{\sqrt {3}\, x} c_2 +{\mathrm e}^{-\sqrt {3}\, x} c_1 -\frac {\cos \left (x \right )}{4} \]
Mathematica. Time used: 0.067 (sec). Leaf size: 37
ode=D[y[x],{x,2}]-3*y[x]==Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\frac {\cos (x)}{4}+c_1 e^{\sqrt {3} x}+c_2 e^{-\sqrt {3} x} \end{align*}
Sympy. Time used: 0.062 (sec). Leaf size: 27
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-3*y(x) - cos(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- \sqrt {3} x} + C_{2} e^{\sqrt {3} x} - \frac {\cos {\left (x \right )}}{4} \]