68.2.15 problem 20

Internal problem ID [17143]
Book : INTRODUCTORY DIFFERENTIAL EQUATIONS. Martha L. Abell, James P. Braselton. Fourth edition 2014. ElScAe. 2014
Section : Chapter 1. Introduction to Differential Equations. Review exercises, page 23
Problem number : 20
Date solved : Thursday, October 02, 2025 at 01:44:59 PM
CAS classification : [[_linear, `class A`]]

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

With initial conditions

\begin{align*} y \left (0\right )&=1 \\ \end{align*}
Maple. Time used: 0.021 (sec). Leaf size: 20
ode:=diff(y(x),x)+2*y(x) = x^2; 
ic:=[y(0) = 1]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = \frac {x^{2}}{2}-\frac {x}{2}+\frac {1}{4}+\frac {3 \,{\mathrm e}^{-2 x}}{4} \]
Mathematica. Time used: 0.022 (sec). Leaf size: 31
ode=D[y[x],x]+2*y[x]==x^2; 
ic={y[0]==1}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{-2 x} \left (\int _0^xe^{2 K[1]} K[1]^2dK[1]+1\right ) \end{align*}
Sympy. Time used: 0.080 (sec). Leaf size: 22
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 + 2*y(x) + Derivative(y(x), x),0) 
ics = {y(0): 1} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {x^{2}}{2} - \frac {x}{2} + \frac {1}{4} + \frac {3 e^{- 2 x}}{4} \]