2.1.4 Problem 4

Solved as first order separable ode
Solved as first order Exact ode
Maple
Mathematica
Sympy

Internal problem ID [8716]
Book : Own collection of miscellaneous problems
Section : section 1.0
Problem number : 4
Date solved : Wednesday, March 05, 2025 at 06:13:26 AM
CAS classification : [_separable]

Solve

y=(sin(y)+y)(sec(x)+5x)x

Solved as first order separable ode

Time used: 0.367 (sec)

The ode

(1)y=(sin(y)+y)(sec(x)+5x)x

is separable as it can be written as

y=(sin(y)+y)(sec(x)+5x)x=f(x)g(y)

Where

f(x)=sec(x)+5xxg(y)=sin(y)+y

Integrating gives

1g(y)dy=f(x)dx1sin(y)+ydy=sec(x)+5xxdx
y1sin(τ)+τdτ=sec(x)+5xxdx+2c1

We now need to find the singular solutions, these are found by finding for what values g(y) is zero, since we had to divide by this above. Solving g(y)=0 or

sin(y)+y=0

for y gives

y=0

Now we go over each such singular solution and check if it verifies the ode itself and any initial conditions given. If it does not then the singular solution will not be used.

Therefore the solutions found are

y1sin(τ)+τdτ=sec(x)+5xxdx+2c1y=0
Figure 2.7: Slope field y=(sin(y)+y)(sec(x)+5x)x

Summary of solutions found

y1sin(τ)+τdτ=sec(x)+5xxdx+2c1y=0
Solved as first order Exact ode

Time used: 0.345 (sec)

To solve an ode of the form

(A)M(x,y)+N(x,y)dydx=0

We assume there exists a function ϕ(x,y)=c where c is constant, that satisfies the ode. Taking derivative of ϕ w.r.t. x gives

ddxϕ(x,y)=0

Hence

(B)ϕx+ϕydydx=0

Comparing (A,B) shows that

ϕx=Mϕy=N

But since 2ϕxy=2ϕyx then for the above to be valid, we require that

My=Nx

If the above condition is satisfied, then the original ode is called exact. We still need to determine ϕ(x,y) but at least we know now that we can do that since the condition 2ϕxy=2ϕyx is satisfied. If this condition is not satisfied then this method will not work and we have to now look for an integrating factor to force this condition, which might or might not exist. The first step is to write the ODE in standard form to check for exactness, which is

(1A)M(x,y)dx+N(x,y)dy=0

Therefore

dy=((sin(y)+y)(sec(x)+5x)x)dx(2A)((sin(y)+y)(sec(x)+5x)x)dx+dy=0

Comparing (1A) and (2A) shows that

M(x,y)=(sin(y)+y)(sec(x)+5x)xN(x,y)=1

The next step is to determine if the ODE is is exact or not. The ODE is exact when the following condition is satisfied

My=Nx

Using result found above gives

My=y((sin(y)+y)(sec(x)+5x)x)=(cos(y)+1)(sec(x)+5x)x

And

Nx=x(1)=0

Since MyNx, then the ODE is not exact. Since the ODE is not exact, we will try to find an integrating factor to make it exact. Let

A=1N(MyNx)=1(((cos(y)+1)(sec(x)+5x)x)(0))=(cos(y)+1)(sec(x)+5x)x

Since A depends on y, it can not be used to obtain an integrating factor. We will now try a second method to find an integrating factor. Let

B=1M(NxMy)=x(sin(y)+y)(sec(x)+5x)((0)((cos(y)+1)(sec(x)+5x)x))=cos(y)1sin(y)+y

Since B does not depend on x, it can be used to obtain an integrating factor. Let the integrating factor be μ. Then

μ=eBdy=ecos(y)1sin(y)+ydy

The result of integrating gives

μ=eln(sin(y)+y)=1sin(y)+y

M and N are now multiplied by this integrating factor, giving new M and new N which are called M and N so not to confuse them with the original M and N.

M=μM=1sin(y)+y((sin(y)+y)(sec(x)+5x)x)=sec(x)5xx

And

N=μN=1sin(y)+y(1)=1sin(y)+y

So now a modified ODE is obtained from the original ODE which will be exact and can be solved using the standard method. The modified ODE is

M+Ndydx=0(sec(x)5xx)+(1sin(y)+y)dydx=0

The following equations are now set up to solve for the function ϕ(x,y)

(1)ϕx=M(2)ϕy=N

Integrating (1) w.r.t. x gives

ϕxdx=Mdxϕxdx=sec(x)5xxdx(3)ϕ=sec(x)5xxdx+f(y)

Where f(y) is used for the constant of integration since ϕ is a function of both x and y. Taking derivative of equation (3) w.r.t y gives

(4)ϕy=0+f(y)

But equation (2) says that ϕy=1sin(y)+y. Therefore equation (4) becomes

(5)1sin(y)+y=0+f(y)

Solving equation (5) for f(y) gives

f(y)=1sin(y)+y

Integrating the above w.r.t y gives

f(y)dy=(1sin(y)+y)dyf(y)=y1sin(τ)+τdτ+c1

Where c1 is constant of integration. Substituting result found above for f(y) into equation (3) gives ϕ

ϕ=sec(x)5xxdx+y1sin(τ)+τdτ+c1

But since ϕ itself is a constant function, then let ϕ=c2 where c2 is new constant and combining c1 and c2 constants into the constant c1 gives the solution as

c1=sec(x)5xxdx+y1sin(τ)+τdτ
Figure 2.8: Slope field y=(sin(y)+y)(sec(x)+5x)x

Summary of solutions found

sec(x)5xxdx+y1sin(τ)+τdτ=c1
Maple. Time used: 0.005 (sec). Leaf size: 30
ode:=diff(y(x),x) = (5+sec(x)/x)*(sin(y(x))+y(x)); 
dsolve(ode,y(x), singsol=all);
 
5x+sec(x)xdxy1sin(_a)+_ad_a+c1=0

Maple trace

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

Maple step by step

Let’s solveddxy(x)=(5+sec(x)x)(sin(y(x))+y(x))Highest derivative means the order of the ODE is1ddxy(x)Solve for the highest derivativeddxy(x)=(5+sec(x)x)(sin(y(x))+y(x))Separate variablesddxy(x)sin(y(x))+y(x)=5+sec(x)xIntegrate both sides with respect toxddxy(x)sin(y(x))+y(x)dx=(5+sec(x)x)dx+C1Cannot compute integralddxy(x)sin(y(x))+y(x)dx=5x+2eIx((eIx)2+1)xdx+C1
Mathematica. Time used: 21.094 (sec). Leaf size: 168
ode=D[y[x],x] == (5+Sec[x]/x)*(Sin[y[x]]+y[x]); 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
Solve[1x(2sec(K[1])K[1]5(sec(K[1])sin(K[1]y(x))+sec(K[1])sin(K[1]+y(x))+2y(x))sin(y(x))+y(x))dK[1]+1y(x)(2K[2]+sin(K[2])1x(5(cos(K[2])+1)(2K[2]sec(K[1])sin(K[1]K[2])+sec(K[1])sin(K[1]+K[2]))(K[2]+sin(K[2]))25(cos(K[1]K[2])sec(K[1])+cos(K[1]+K[2])sec(K[1])+2)K[2]+sin(K[2]))dK[1])dK[2]=c1,y(x)]
Sympy. Time used: 2.570 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq((-5 - 1/(x*cos(x)))*(y(x) + sin(y(x))) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
y(x)1y+sin(y)dy=C1+5xcos(x)+1xcos(x)dx