23.3.12 problem 8(b)

Internal problem ID [4153]
Book : Theory and solutions of Ordinary Differential equations, Donald Greenspan, 1960
Section : Chapter 4. The general linear differential equation of order n. Exercises at page 63
Problem number : 8(b)
Date solved : Sunday, March 30, 2025 at 02:41:06 AM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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

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