82.32.2 problem Ex. 3

Internal problem ID [18822]
Book : Introductory Course On Differential Equations by Daniel A Murray. Longmans Green and Co. NY. 1924
Section : Chapter VI. Linear equations with constant coefficients. problems at page 80
Problem number : Ex. 3
Date solved : Monday, March 31, 2025 at 06:15:48 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-y&=x^{2} \cos \left (x \right ) \end{align*}

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