2.4 problem 4

2.4.1 Solving as separable ode
2.4.2 Maple step by step solution

Internal problem ID [5090]
Internal file name [OUTPUT/4583_Sunday_June_05_2022_03_01_19_PM_25170665/index.tex]

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: 4.
ODE order: 1.
ODE degree: 1.

The type(s) of ODE detected by this program : "exact", "separable", "first_order_ode_lie_symmetry_lookup"

Maple gives the following as the ode type

[_separable]

\[ \boxed {\cos \left (y\right )+\left (1+{\mathrm e}^{-x}\right ) \sin \left (y\right ) y^{\prime }=0} \] With initial conditions \begin {align*} \left [y \left (0\right ) = \frac {\pi }{4}\right ] \end {align*}

2.4.1 Solving as separable ode

In canonical form the ODE is \begin {align*} y' &= F(x,y)\\ &= f( x) g(y)\\ &= -\frac {\cot \left (y \right )}{1+{\mathrm e}^{-x}} \end {align*}

Where \(f(x)=-\frac {1}{1+{\mathrm e}^{-x}}\) and \(g(y)=\cot \left (y \right )\). Integrating both sides gives \begin{align*} \frac {1}{\cot \left (y \right )} \,dy &= -\frac {1}{1+{\mathrm e}^{-x}} \,d x \\ \int { \frac {1}{\cot \left (y \right )} \,dy} &= \int {-\frac {1}{1+{\mathrm e}^{-x}} \,d x} \\ -\ln \left (\cos \left (y \right )\right )&=-\ln \left (1+{\mathrm e}^{-x}\right )+\ln \left ({\mathrm e}^{-x}\right )+c_{1} \\ \end{align*} Raising both side to exponential gives \begin {align*} \frac {1}{\cos \left (y \right )} &= {\mathrm e}^{-\ln \left (1+{\mathrm e}^{-x}\right )+\ln \left ({\mathrm e}^{-x}\right )+c_{1}} \end {align*}

Which simplifies to \begin {align*} \sec \left (y \right ) &= c_{2} {\mathrm e}^{-\ln \left (1+{\mathrm e}^{-x}\right )+\ln \left ({\mathrm e}^{-x}\right )} \end {align*}

Initial conditions are used to solve for \(c_{1}\). Substituting \(x=0\) and \(y=\frac {\pi }{4}\) in the above solution gives an equation to solve for the constant of integration. \begin {align*} \frac {\pi }{4} = \frac {\pi }{2}-\arcsin \left (\frac {2 \,{\mathrm e}^{-c_{1}}}{c_{2}}\right ) \end {align*}

The solutions are \begin {align*} c_{1} = -\frac {\ln \left (\frac {c_{2}^{2}}{8}\right )}{2} \end {align*}

Trying the constant \begin {align*} c_{1} = -\frac {\ln \left (\frac {c_{2}^{2}}{8}\right )}{2} \end {align*}

Substituting this in the general solution gives \begin {align*} y&=\frac {\pi }{2}-\arcsin \left (\frac {\left ({\mathrm e}^{x}+1\right ) \sqrt {2}}{4}\right ) \end {align*}

The constant \(c_{1} = -\frac {\ln \left (\frac {c_{2}^{2}}{8}\right )}{2}\) gives valid solution.

Summary

The solution(s) found are the following \begin{align*} \tag{1} y &= \frac {\pi }{2}-\arcsin \left (\frac {\left ({\mathrm e}^{x}+1\right ) \sqrt {2}}{4}\right ) \\ \end{align*}

(a) Solution plot

(b) Slope field plot

Verification of solutions

\[ y = \frac {\pi }{2}-\arcsin \left (\frac {\left ({\mathrm e}^{x}+1\right ) \sqrt {2}}{4}\right ) \] Verified OK.

2.4.2 Maple step by step solution

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & \left [\cos \left (y\right )+\left (1+{\mathrm e}^{-x}\right ) \sin \left (y\right ) y^{\prime }=0, y \left (0\right )=\frac {\pi }{4}\right ] \\ \bullet & {} & \textrm {Highest derivative means the order of the ODE is}\hspace {3pt} 1 \\ {} & {} & y^{\prime } \\ \bullet & {} & \textrm {Solve for the highest derivative}\hspace {3pt} \\ {} & {} & y^{\prime }=-\frac {\cos \left (y\right )}{\left (1+{\mathrm e}^{-x}\right ) \sin \left (y\right )} \\ \bullet & {} & \textrm {Separate variables}\hspace {3pt} \\ {} & {} & \frac {y^{\prime } \sin \left (y\right )}{\cos \left (y\right )}=-\frac {1}{1+{\mathrm e}^{-x}} \\ \bullet & {} & \textrm {Integrate both sides with respect to}\hspace {3pt} x \\ {} & {} & \int \frac {y^{\prime } \sin \left (y\right )}{\cos \left (y\right )}d x =\int -\frac {1}{1+{\mathrm e}^{-x}}d x +c_{1} \\ \bullet & {} & \textrm {Evaluate integral}\hspace {3pt} \\ {} & {} & -\ln \left (\cos \left (y\right )\right )=-\ln \left (1+{\mathrm e}^{-x}\right )+\ln \left ({\mathrm e}^{-x}\right )+c_{1} \\ \bullet & {} & \textrm {Solve for}\hspace {3pt} y \\ {} & {} & y=\arccos \left (\frac {{\mathrm e}^{x -c_{1}} \left ({\mathrm e}^{x}+1\right )}{{\mathrm e}^{x}}\right ) \\ \bullet & {} & \textrm {Use initial condition}\hspace {3pt} y \left (0\right )=\frac {\pi }{4} \\ {} & {} & \frac {\pi }{4}=\arccos \left (2 \,{\mathrm e}^{-c_{1}}\right ) \\ \bullet & {} & \textrm {Solve for}\hspace {3pt} c_{1} \\ {} & {} & c_{1} =\frac {3 \ln \left (2\right )}{2} \\ \bullet & {} & \textrm {Substitute}\hspace {3pt} c_{1} =\frac {3 \ln \left (2\right )}{2}\hspace {3pt}\textrm {into general solution and simplify}\hspace {3pt} \\ {} & {} & y=\arccos \left (\frac {\left ({\mathrm e}^{x}+1\right ) \sqrt {2}}{4}\right ) \\ \bullet & {} & \textrm {Solution to the IVP}\hspace {3pt} \\ {} & {} & y=\arccos \left (\frac {\left ({\mathrm e}^{x}+1\right ) \sqrt {2}}{4}\right ) \end {array} \]

Maple trace

`Methods for first order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying 1st order linear 
trying Bernoulli 
trying separable 
<- separable successful`
 

Solution by Maple

Time used: 0.344 (sec). Leaf size: 14

dsolve([cos(y(x))+(1+exp(-x))*sin(y(x))*diff(y(x),x)=0,y(0) = 1/4*Pi],y(x), singsol=all)
 

\[ y \left (x \right ) = \arccos \left (\frac {\sqrt {2}\, \left ({\mathrm e}^{x}+1\right )}{4}\right ) \]

Solution by Mathematica

Time used: 50.086 (sec). Leaf size: 20

DSolve[{Cos[y[x]]+(1+Exp[-x])*Sin[y[x]]*y'[x]==0,{y[0]==Pi/4}},y[x],x,IncludeSingularSolutions -> True]
 

\[ y(x)\to \arccos \left (\frac {e^x+1}{2 \sqrt {2}}\right ) \]