29.1.9 problem 8

Internal problem ID [4616]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Various 1
Problem number : 8
Date solved : Sunday, March 30, 2025 at 03:30:34 AM
CAS classification : [_linear]

\begin{align*} y^{\prime }&=x \left ({\mathrm e}^{-x^{2}}+a y\right ) \end{align*}

Maple. Time used: 0.002 (sec). Leaf size: 27
ode:=diff(y(x),x) = x*(exp(-x^2)+a*y(x)); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {{\mathrm e}^{-x^{2}}}{2+a}+{\mathrm e}^{\frac {x^{2} a}{2}} c_1 \]
Mathematica. Time used: 0.132 (sec). Leaf size: 42
ode=D[y[x],x]==x*(Exp[-x^2]+a*y[x]); 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {e^{\frac {a x^2}{2}} \left (-e^{-\frac {1}{2} (a+2) x^2}+(a+2) c_1\right )}{a+2} \]
Sympy. Time used: 6.054 (sec). Leaf size: 100
from sympy import * 
x = symbols("x") 
a = symbols("a") 
y = Function("y") 
ode = Eq(-x*(a*y(x) + exp(-x**2)) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = \begin {cases} C_{1} e^{- x^{2}} + \frac {x^{2} e^{- x^{2}}}{2} & \text {for}\: a = -2 \\\text {NaN} & \text {otherwise} \end {cases}, \ y{\left (x \right )} = \begin {cases} \frac {C_{1} a e^{\frac {a x^{2}}{2} + x^{2}}}{a e^{x^{2}} + 2 e^{x^{2}}} + \frac {2 C_{1} e^{\frac {a x^{2}}{2} + x^{2}}}{a e^{x^{2}} + 2 e^{x^{2}}} - \frac {1}{a e^{x^{2}} + 2 e^{x^{2}}} & \text {for}\: a \neq -2 \\\text {NaN} & \text {otherwise} \end {cases}\right ] \]