44.6.44 problem 44

Internal problem ID [7188]
Book : A First Course in Differential Equations with Modeling Applications by Dennis G. Zill. 12 ed. Metric version. 2024. Cengage learning.
Section : Chapter 2. First order differential equations. Section 2.3 Linear equations. Exercises 2.3 at page 63
Problem number : 44
Date solved : Sunday, March 30, 2025 at 11:50:38 AM
CAS classification : [_linear]

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

With initial conditions

\begin{align*} y \left (0\right )&=\frac {\sqrt {\pi }}{2} \end{align*}

Maple. Time used: 0.049 (sec). Leaf size: 17
ode:=diff(y(x),x)-2*x*y(x) = -1; 
ic:=y(0) = 1/2*Pi^(1/2); 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = -\frac {\sqrt {\pi }\, \left (\operatorname {erf}\left (x \right )-1\right ) {\mathrm e}^{x^{2}}}{2} \]
Mathematica. Time used: 0.025 (sec). Leaf size: 23
ode=D[y[x],x]-2*x*y[x]==-1; 
ic={y[0]==Sqrt[Pi]/2}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -\frac {1}{2} \sqrt {\pi } e^{x^2} (\text {erf}(x)-1) \]
Sympy. Time used: 0.355 (sec). Leaf size: 24
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-2*x*y(x) + Derivative(y(x), x) + 1,0) 
ics = {y(0): sqrt(pi)/2} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (- \frac {\sqrt {\pi } \operatorname {erf}{\left (x \right )}}{2} + \frac {\sqrt {\pi }}{2}\right ) e^{x^{2}} \]