2.1.15 Problem 15

Solved using first_order_ode_quadrature
Solved using first_order_ode_exact
Maple
Mathematica
Sympy

Internal problem ID [8727]
Book : Own collection of miscellaneous problems
Section : section 1.0
Problem number : 15
Date solved : Sunday, March 30, 2025 at 01:25:10 PM
CAS classification : [_quadrature]

Solved using first_order_ode_quadrature

Time used: 0.029 (sec)

Solve

y=1x

Since the ode has the form y=f(x), then we only need to integrate f(x).

dy=1xdxy=ln(x)+c1
Figure 2.36: Slope field y=1x

Summary of solutions found

y=ln(x)+c1
Solved using first_order_ode_exact

Time used: 0.045 (sec)

Solve

y=1x

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=(1x)dx(2A)(1x)dx+dy=0

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

M(x,y)=1xN(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(1x)=0

And

Nx=x(1)=0

Since My=Nx, then the ODE is exact 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=1xdx(3)ϕ=ln(x)+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=1. Therefore equation (4) becomes

(5)1=0+f(y)

Solving equation (5) for f(y) gives

f(y)=1

Integrating the above w.r.t y gives

f(y)dy=(1)dyf(y)=y+c2

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

ϕ=ln(x)+y+c2

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

c2=ln(x)+y

Solving for y gives

y=c2+ln(x)
Figure 2.37: Slope field y=1x

Summary of solutions found

y=c2+ln(x)
Maple. Time used: 0.001 (sec). Leaf size: 8
ode:=diff(y(x),x) = 1/x; 
dsolve(ode,y(x), singsol=all);
 
y=ln(x)+c1

Maple trace

Methods for first order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
<- quadrature successful
 

Maple step by step

Let’s solveddxy(x)=1xHighest derivative means the order of the ODE is1ddxy(x)Integrate both sides with respect tox(ddxy(x))dx=1xdx+C1Evaluate integraly(x)=ln(x)+C1
Mathematica. Time used: 0.003 (sec). Leaf size: 10
ode=D[y[x],x] == 1/x; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
y(x)log(x)+c1
Sympy. Time used: 0.182 (sec). Leaf size: 7
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(Derivative(y(x), x) - 1/x,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
y(x)=C1+log(x)