Means \(order=1\), \(degree=1\). We only can observe notations like \(dx\), \(dy\). And there are no notations such as \(d^2x\), \(d^2y\). And there are no notations such as \((dx)^2\), \((dy)^2\).
Because, \(y\) is a function of \(x\), we cannot treating \(y\) as a constant to integrate w.r.t \(x\). It is a good idea to separate variables \(x\) and \(y\) by the equal sign.
We have example \[(1+x)^2dy-xydx=0\] Do the separation we have \[\frac{dy}{y}=\frac{xdx}{1+x^2}\] Integrating left hand side
require(mosaicCalc)
## Loading required package: mosaicCalc
## Warning: package 'mosaicCalc' was built under R version 4.0.5
## Loading required package: mosaicCore
## Warning: package 'mosaicCore' was built under R version 4.0.5
## Registered S3 method overwritten by 'mosaic':
## method from
## fortify.SpatialPolygonsDataFrame ggplot2
##
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
##
## D
require(Deriv)
## Loading required package: Deriv
## Warning: package 'Deriv' was built under R version 4.0.5
exp1=antiD(1/y~y)
exp1
## function (y, C = 0)
## 1 * log((y)) + C
We get \[\log(y)+C_1\]
Integrating right hand side, we need substitution. It just changes \(dx\) to \(du\), we do need to know the relation of \(dx\) and \(du\), it depends on how we define \(u\). We define \(u=x^2+1\). So \(du/dx=2x\), and \(dx=du/(2x)\).
#full is expression, sub is substitution part, x1 is original variable,
#x2 is new variable.
substitution<-function(full,sub,x1="x",x2="u"){
dudx=Deriv(sub,x1)
dx=paste0("1/(",dudx,")")
expr=gsub(sub, x2, full,fixed=TRUE)
expr=paste0(expr,"*",dx)
expr=Simplify(expr)
expr=paste0(expr,"~",x2)
return(expr)
}
u="x^2+1"
substitution("x/(x^2+1)","x^2+1" )
## [1] "1/(2 * u)~u"
So the right hand side in term of \(u\) is \(1/(2u)\).
Integrate right hand side in term of \(u\), replace \(u=x^2+1\).
antiD(1/2 *1/ u~u)
## function (u, C = 0)
## 1/2 * log((u)) + C
exp2=gsub("u", u, "1/2 * log((u)) + C",fixed=TRUE)
exp2
## [1] "1/2 * log((x^2+1)) + C"
#expr=as.formula(expr)
We get \[\frac{1}{2}\log(x^2+1) + C_2\]
\(C_1\), \(C_2\) are constants, sum and log them is a constant \[\log(y)+C_1=\frac{1}{2}\log(x^2+1) + C_2\] \[\log(y)=\frac{1}{2}\log(x^2+1) + \log(C)\] \[\log(y)=\log C(x^2+1)^{1/2} \]
Removing log \[y= C(x^2+1)^{1/2} \]
https://www.mathsisfun.com/calculus/homogeneous-function.html
We put \(dy/dx\) to one side, and the rest on the other side appears to have a ratio form. If we have homogeneous functions, we can cancel variable \(x\) by letting \(y=vx\).
For example \[(x^2 - y^2)dx + 2xy dy = 0\] \[\frac{dy}{dx}=-\frac{x^2-y^2}{2xy}\] Let \(y=vx\) \[\frac{dy}{dx}=-\frac{x^2-v^2x^2}{2x^2v}=-\frac{1-v^2}{2v}\] Let \(dy = v dx + x dv\) \[\frac{v dx + x dv}{dx}=-\frac{1-v^2}{2v}\] \[v+\frac{ x dv}{dx}=-\frac{1-v^2}{2v}\] \[\frac{ x dv}{dx}=-\frac{1-v^2}{2v}-v\] \[-\frac{ dx }{x}=\frac{2vdv}{v^2+1}\] Now we have variables separated.
The differential equation is in form \[M(x, y) dx + N(x, y) dy = 0\] If we have the exact condition, then it is the exact differential equation of primitive \(u\), such as \[du(x,y)=\frac{\partial u(x,y)}{\partial x}dx+\frac{\partial u(x,y)}{\partial y}dy=M(x, y) dx + N(x, y) dy\] implies \[\frac{\partial u(x,y)}{\partial x}=M(x,y),\\ \frac{\partial u(x,y)}{\partial y}=N(x,y)\] so that \[u=\int M\partial x,\\ u=\int N\partial y\]
Please refer to the formula for the general solution.
Let the equation \[M(x,y)dx+N(x,y)dy=0\] is not exact. It can be made exact by multiplying through a function of x and y, which is called an integrating factor.
First order linear means the first order derivative \(y'\) is linear \(P(x)y+Q(x)\).