24.1.15 problem 3(a)

Internal problem ID [4204]
Book : Elementary Differential equations, Chaundy, 1969
Section : Exercises 3, page 60
Problem number : 3(a)
Date solved : Sunday, March 30, 2025 at 02:42:40 AM
CAS classification : [_linear]

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

Maple. Time used: 0.001 (sec). Leaf size: 15
ode:=tan(x)*diff(y(x),x) = y(x)-cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \left (\cot \left (x \right )-\frac {\pi }{2}+x +c_1 \right ) \sin \left (x \right ) \]
Mathematica. Time used: 0.054 (sec). Leaf size: 28
ode=Tan[x]*D[y[x],x]==y[x]-Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \cos (x) \operatorname {Hypergeometric2F1}\left (-\frac {1}{2},1,\frac {1}{2},-\tan ^2(x)\right )+c_1 \sin (x) \]
Sympy. Time used: 0.719 (sec). Leaf size: 15
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-y(x) + cos(x) + tan(x)*Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (x \right )} + x \sin {\left (x \right )} + \cos {\left (x \right )} \]