89.23.17 problem 17

Internal problem ID [24821]
Book : A short course in Differential Equations. Earl D. Rainville. Second edition. 1958. Macmillan Publisher, NY. CAT 58-5010
Section : Chapter 10. Nonhomogeneous Equations: Operational methods. Miscellaneous Exercises at page 162
Problem number : 17
Date solved : Thursday, October 02, 2025 at 10:48:19 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} 4 y+y^{\prime \prime }&=8 \cos \left (x \right )^{2} \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 22
ode:=diff(diff(y(x),x),x)+4*y(x) = 8*cos(x)^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \left (c_1 +1\right ) \cos \left (2 x \right )+1+\left (c_2 +x \right ) \sin \left (2 x \right ) \]
Mathematica. Time used: 0.018 (sec). Leaf size: 25
ode=D[y[x],{x,2}]+4*y[x]==8*Cos[x]^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to (1+c_1) \cos (2 x)+(x+c_2) \sin (2 x)+1 \end{align*}
Sympy. Time used: 0.416 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(4*y(x) - 8*cos(x)**2 + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} \cos {\left (2 x \right )} + \left (C_{1} + x\right ) \sin {\left (2 x \right )} + 1 \]