23.3.29 problem 29

Internal problem ID [5743]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Part II. Chapter 3. THE DIFFERENTIAL EQUATION IS LINEAR AND OF SECOND ORDER, page 311
Problem number : 29
Date solved : Tuesday, September 30, 2025 at 02:02:23 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} a^{2} y+y^{\prime \prime }&=x^{2}+x +1 \end{align*}
Maple. Time used: 0.004 (sec). Leaf size: 38
ode:=a^2*y(x)+diff(diff(y(x),x),x) = x^2+x+1; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\cos \left (a x \right ) c_1 \,a^{4}+\sin \left (a x \right ) c_2 \,a^{4}-2+\left (x^{2}+x +1\right ) a^{2}}{a^{4}} \]
Mathematica. Time used: 0.01 (sec). Leaf size: 36
ode=a^2*y[x] + D[y[x],{x,2}] == 1 + x + x^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {a^2 \left (x^2+x+1\right )-2}{a^4}+c_1 \cos (a x)+c_2 \sin (a x) \end{align*}
Sympy. Time used: 0.064 (sec). Leaf size: 41
from sympy import * 
x = symbols("x") 
a = symbols("a") 
y = Function("y") 
ode = Eq(a**2*y(x) - x**2 - x + Derivative(y(x), (x, 2)) - 1,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- i a x} + C_{2} e^{i a x} + \frac {x^{2}}{a^{2}} + \frac {x}{a^{2}} + \frac {1}{a^{2}} - \frac {2}{a^{4}} \]