69.17.17 problem 567

Internal problem ID [18353]
Book : A book of problems in ordinary differential equations. M.L. KRASNOV, A.L. KISELYOV, G.I. MARKARENKO. MIR, MOSCOW. 1983
Section : Chapter 2 (Higher order ODEs). Section 15.3 Nonhomogeneous linear equations with constant coefficients. Superposition principle. Exercises page 137
Problem number : 567
Date solved : Thursday, October 02, 2025 at 03:10:47 PM
CAS classification : [[_2nd_order, _missing_y]]

\begin{align*} y^{\prime \prime }+y^{\prime }&=\cos \left (x \right )^{2}+{\mathrm e}^{x}+x^{2} \end{align*}
Maple. Time used: 0.001 (sec). Leaf size: 42
ode:=diff(diff(y(x),x),x)+diff(y(x),x) = cos(x)^2+exp(x)+x^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = -x^{2}+\frac {x^{3}}{3}-{\mathrm e}^{-x} c_1 +\frac {{\mathrm e}^{x}}{2}-\frac {\cos \left (2 x \right )}{10}+\frac {\sin \left (2 x \right )}{20}+\frac {5 x}{2}+c_2 \]
Mathematica. Time used: 3.733 (sec). Leaf size: 60
ode=D[y[x],{x,2}]+D[y[x],x]==Cos[x]^2+Exp[x]+x^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \int _1^xe^{-K[2]} \left (c_1+\int _1^{K[2]}\frac {1}{2} e^{K[1]} \left (2 K[1]^2+2 e^{K[1]}+\cos (2 K[1])+1\right )dK[1]\right )dK[2]+c_2 \end{align*}
Sympy. Time used: 0.393 (sec). Leaf size: 41
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 - exp(x) - cos(x)**2 + Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} + C_{2} e^{- x} + \frac {x^{3}}{3} - x^{2} + \frac {5 x}{2} + \frac {e^{x}}{2} + \frac {\sin {\left (2 x \right )}}{20} - \frac {\cos {\left (2 x \right )}}{10} \]