38.2.13 problem 13

Internal problem ID [6442]
Book : Engineering Mathematics. By K. A. Stroud. 5th edition. Industrial press Inc. NY. 2001
Section : Program 24. First order differential equations. Further problems 24. page 1068
Problem number : 13
Date solved : Sunday, March 30, 2025 at 11:01:15 AM
CAS classification : [_linear]

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

With initial conditions

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

Maple. Time used: 0.020 (sec). Leaf size: 14
ode:=-y(x)+x*diff(y(x),x) = x^3*cos(x); 
ic:=y(Pi) = 0; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = \left (\cos \left (x \right )+x \sin \left (x \right )+1\right ) x \]
Mathematica. Time used: 0.042 (sec). Leaf size: 15
ode=x*D[y[x],x]-y[x]==x^3*Cos[x]; 
ic={y[Pi]==0}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to x (x \sin (x)+\cos (x)+1) \]
Sympy. Time used: 0.365 (sec). Leaf size: 14
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**3*cos(x) + x*Derivative(y(x), x) - y(x),0) 
ics = {y(pi): 0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x \left (x \sin {\left (x \right )} + \cos {\left (x \right )} + 1\right ) \]