37.2.3 problem 10.3.4

Internal problem ID [6400]
Book : Basic Training in Mathematics. By R. Shankar. Plenum Press. NY. 1995
Section : Chapter 10, Differential equations. Section 10.3, ODEs with variable Coefficients. First order. page 315
Problem number : 10.3.4
Date solved : Wednesday, March 05, 2025 at 12:39:05 AM
CAS classification : [[_linear, `class A`]]

\begin{align*} y^{\prime }+y&=\left (x +1\right )^{2} \end{align*}

With initial conditions

\begin{align*} y \left (0\right )&=0 \end{align*}

Maple. Time used: 0.006 (sec). Leaf size: 15
ode:=diff(y(x),x)+y(x) = (1+x)^2; 
ic:=y(0) = 0; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = x^{2}+1-{\mathrm e}^{-x} \]
Mathematica. Time used: 0.142 (sec). Leaf size: 17
ode=D[y[x],x]+y[x]==(x+1)^2; 
ic={y[0]==0}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to x^2-e^{-x}+1 \]
Sympy. Time used: 0.154 (sec). Leaf size: 12
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-(x + 1)**2 + y(x) + Derivative(y(x), x),0) 
ics = {y(0): 0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x^{2} + 1 - e^{- x} \]