40.11.9 problem 34

Internal problem ID [6743]
Book : Schaums Outline. Theory and problems of Differential Equations, 1st edition. Frank Ayres. McGraw Hill 1952
Section : Chapter 16. Linear equations with constant coefficients (Short methods). Supplemetary problems. Page 107
Problem number : 34
Date solved : Sunday, March 30, 2025 at 11:21:11 AM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} y^{\prime \prime }-y&=x^{2} \end{align*}

Maple. Time used: 0.003 (sec). Leaf size: 21
ode:=diff(diff(y(x),x),x)-y(x) = x^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{-x} c_2 +{\mathrm e}^{x} c_1 -x^{2}-2 \]
Mathematica. Time used: 0.015 (sec). Leaf size: 26
ode=D[y[x],{x,2}]-y[x]==x^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -x^2+c_1 e^x+c_2 e^{-x}-2 \]
Sympy. Time used: 0.094 (sec). Leaf size: 17
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 - 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} - x^{2} - 2 \]