32.4.7 problem 7

Internal problem ID [7780]
Book : Engineering Mathematics. By K. A. Stroud. 5th edition. Industrial press Inc. NY. 2001
Section : Program 25. Second order differential equations. Further problems 25. page 1094
Problem number : 7
Date solved : Tuesday, September 30, 2025 at 05:05:22 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+4 y^{\prime }+4 y&=2 \cos \left (x \right )^{2} \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 22
ode:=diff(diff(y(x),x),x)+4*diff(y(x),x)+4*y(x) = 2*cos(x)^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {1}{4}+\left (c_1 x +c_2 \right ) {\mathrm e}^{-2 x}+\frac {\sin \left (2 x \right )}{8} \]
Mathematica. Time used: 0.078 (sec). Leaf size: 62
ode=D[y[x],{x,2}]+4*D[y[x],x]+4*y[x]==2*Cos[x]^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{-2 x} \left (x \int _1^x2 e^{2 K[2]} \cos ^2(K[2])dK[2]+\int _1^x-2 e^{2 K[1]} \cos ^2(K[1]) K[1]dK[1]+c_2 x+c_1\right ) \end{align*}
Sympy. Time used: 0.495 (sec). Leaf size: 22
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(4*y(x) - 2*cos(x)**2 + 4*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} + C_{2} x\right ) e^{- 2 x} + \frac {\sin {\left (2 x \right )}}{8} + \frac {1}{4} \]