9.6.2 problem 2

Internal problem ID [2959]
Book : Differential Equations by Alfred L. Nelson, Karl W. Folley, Max Coral. 3rd ed. DC heath. Boston. 1964
Section : Exercise 10, page 41
Problem number : 2
Date solved : Tuesday, September 30, 2025 at 06:12:36 AM
CAS classification : [_linear]

\begin{align*} y^{\prime }-x y&={\mathrm e}^{\frac {x^{2}}{2}} \cos \left (x \right ) \end{align*}
Maple. Time used: 0.001 (sec). Leaf size: 15
ode:=diff(y(x),x)-x*y(x) = exp(1/2*x^2)*cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \left (\sin \left (x \right )+c_1 \right ) {\mathrm e}^{\frac {x^{2}}{2}} \]
Mathematica. Time used: 0.037 (sec). Leaf size: 20
ode=D[y[x],x]-x*y[x]==Exp[x^2/2]*Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{\frac {x^2}{2}} (\sin (x)+c_1) \end{align*}
Sympy. Time used: 26.886 (sec). Leaf size: 14
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*y(x) - exp(x**2/2)*cos(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} + \sin {\left (x \right )}\right ) e^{\frac {x^{2}}{2}} \]