15.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 : Sunday, March 30, 2025 at 01:02:05 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.069 (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]
 
\[ y(x)\to e^{\frac {x^2}{2}} (\sin (x)+c_1) \]
Sympy. Time used: 40.838 (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}} \]