75.16.69 problem 542

Internal problem ID [16971]
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. Trial and error method. Exercises page 132
Problem number : 542
Date solved : Monday, March 31, 2025 at 03:36:49 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.003 (sec). Leaf size: 25
ode:=diff(diff(y(x),x),x)-2*diff(y(x),x)+y(x) = x^3; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \left (c_1 x +c_2 \right ) {\mathrm e}^{x}+x^{3}+6 x^{2}+18 x +24 \]
Mathematica. Time used: 0.013 (sec). Leaf size: 31
ode=D[y[x],{x,2}]-2*D[y[x],x]+y[x]==x^3; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to x^3+6 x^2+x \left (18+c_2 e^x\right )+c_1 e^x+24 \]
Sympy. Time used: 0.172 (sec). Leaf size: 24
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**3 + y(x) - 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x^{3} + 6 x^{2} + 18 x + \left (C_{1} + C_{2} x\right ) e^{x} + 24 \]