18.1.19 problem Problem 14.24 (b)

Internal problem ID [3475]
Book : Mathematical methods for physics and engineering, Riley, Hobson, Bence, second edition, 2002
Section : Chapter 14, First order ordinary differential equations. 14.4 Exercises, page 490
Problem number : Problem 14.24 (b)
Date solved : Tuesday, March 04, 2025 at 04:41:34 PM
CAS classification : [_linear]

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

With initial conditions

\begin{align*} y \left (\frac {\pi }{4}\right )&=3 \end{align*}

Maple. Time used: 0.020 (sec). Leaf size: 13
ode:=diff(y(x),x)-y(x)*tan(x) = 1; 
ic:=y(1/4*Pi) = 3; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y \left (x \right ) = \tan \left (x \right )+\sec \left (x \right ) \sqrt {2} \]
Mathematica. Time used: 0.038 (sec). Leaf size: 16
ode=D[y[x],x]-y[x]*Tan[x]==1; 
ic=y[Pi/4]==3; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \left (\sin (x)+\sqrt {2}\right ) \sec (x) \]
Sympy. Time used: 0.494 (sec). Leaf size: 14
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-y(x)*tan(x) + Derivative(y(x), x) - 1,0) 
ics = {y(pi/4): 3} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {\sin {\left (x \right )} + \sqrt {2}}{\cos {\left (x \right )}} \]