17.1.10 problem 1(j)

Internal problem ID [4100]
Book : Theory and solutions of Ordinary Differential equations, Donald Greenspan, 1960
Section : Chapter 2. First order equations. Exercises at page 14
Problem number : 1(j)
Date solved : Tuesday, September 30, 2025 at 07:02:47 AM
CAS classification : [[_linear, `class A`]]

\begin{align*} y^{\prime }+y&=x^{2}+2 \end{align*}
Maple. Time used: 0.001 (sec). Leaf size: 18
ode:=diff(y(x),x)+y(x) = x^2+2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = x^{2}-2 x +4+{\mathrm e}^{-x} c_1 \]
Mathematica. Time used: 0.054 (sec). Leaf size: 21
ode=D[y[x],x]+y[x]==x^2+2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to x^2-2 x+c_1 e^{-x}+4 \end{align*}
Sympy. Time used: 0.069 (sec). Leaf size: 15
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} + x^{2} - 2 x + 4 \]