7.4.30 problem 30

Internal problem ID [102]
Book : Elementary Differential Equations. By C. Henry Edwards, David E. Penney and David Calvis. 6th edition. 2008
Section : Chapter 1. First order differential equations. Section 1.5 (linear equations). Problems at page 54
Problem number : 30
Date solved : Saturday, March 29, 2025 at 04:31:28 PM
CAS classification : [_linear]

\begin{align*} 2 x y^{\prime }&=y+2 x \cos \left (x \right ) \end{align*}

With initial conditions

\begin{align*} y \left (1\right )&=0 \end{align*}

Maple. Time used: 0.053 (sec). Leaf size: 36
ode:=2*x*diff(y(x),x) = y(x)+2*x*cos(x); 
ic:=y(1) = 0; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = \left (-\operatorname {FresnelC}\left (\frac {\sqrt {2}}{\sqrt {\pi }}\right )+\operatorname {FresnelC}\left (\frac {\sqrt {2}\, \sqrt {x}}{\sqrt {\pi }}\right )\right ) \sqrt {2}\, \sqrt {\pi }\, \sqrt {x} \]
Mathematica. Time used: 0.048 (sec). Leaf size: 149
ode=2*x*D[y[x],x]==y[x]+2*x*Cos[x]; 
ic={y[1]==0}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -\frac {\left (\frac {1}{4}-\frac {i}{4}\right ) \sqrt {\pi } \left ((-1-i) x \text {erf}\left (\sqrt {i x}\right )+\sqrt {2} \text {erf}\left (\sqrt [4]{-1}\right ) \sqrt {i x} \sqrt {x}-(1+i) x \text {erfi}\left (\sqrt {i x}\right )+\sqrt {2} \text {erfi}\left (\sqrt [4]{-1}\right ) \sqrt {i x} \sqrt {x}-(1-i) \sqrt {x^2}+(1+i) x-(1+i) \sqrt {2} \sqrt {i x} \sqrt {x}\right )}{\sqrt {i x}} \]
Sympy. Time used: 0.899 (sec). Leaf size: 56
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-2*x*cos(x) + 2*x*Derivative(y(x), x) - y(x),0) 
ics = {y(1): 0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \sqrt {x} \left (\sqrt {2} \sqrt {\pi } C\left (\frac {\sqrt {2} \sqrt {x}}{\sqrt {\pi }}\right ) - \sqrt {2} \sqrt {\pi } C\left (\frac {\sqrt {2}}{\sqrt {\pi }}\right )\right ) \]