findmaxbell {RootsExtremaInflections} | R Documentation |
Implementation of Bell Extreme Finding Estimator (BEFE) algorithm for a planar curve
Description
For a curve that can be classified as 'bell' a fast computation of its maximum is performed by applying Bell Extreme Finding Estimator (BEFE) algorithm of [1].
Usage
findmaxbell(x, y, concave = TRUE)
Arguments
x |
A numeric vector for the independent variable without missing values |
y |
A numeric vector for the dependent variable without missing values |
concave |
Logical input, if TRUE then curve is supposed to have a maximum (default=TRUE) |
Details
If we want to compute minimum we just set concave=FALSE and proceed.
Value
A named vector with next components is returned:
j1 the index of x-left
j2 the index of x-right
chi the estimation of extreme as x-abscissa
Note
Please use function classify_curve
if you have not visual inspection in order to find the extreme type. Do not use that function if curve shape is not 'bell', use either symextreme
or findextreme
.
Author(s)
Demetris T. Christopoulos
References
[1]Demetris T. Christopoulos (2019). New methods for computing extremes and roots of a planar curve: introducing Noisy Numerical Analysis (2019). ResearchGate. http://dx.doi.org/10.13140/RG.2.2.17158.32324
See Also
classify_curve
, symextreme
, findmaxtulip
, findextreme
Examples
#
f=function(x){1/(1+x^2)}
x=seq(-2,2.0,by=0.01);y=f(x)
plot(x,y,pch=19,cex=0.5)
cc=classify_curve(x,y)
cc$shapetype
## 1] "bell"
a1<-findmaxbell(x,y)
a1
## j1 j2 chi
## 1.770000e+02 2.250000e+02 1.110223e-16
abline(v=a1['chi'])
abline(v=x[a1[1:2]],lty=2);abline(h=y[a1[1:2]],lty=2)
points(x[a1[1]:a1[2]],y[a1[1]:a1[2]],pch=19,cex=0.5,col='blue')
#
## Same curve with noise from U(-0.05,0.05)
set.seed(2019-07-26);r=0.05;y=f(x)+runif(length(x),-r,r)
plot(x,y,pch=19,cex=0.5)
cc=classify_curve(x,y)
cc$shapetype
## 1] "bell"
a1<-findmaxbell(x,y)
a1
## j1 j2 chi
## 169.00 229.00 -0.02
abline(v=a1['chi'])
abline(v=x[a1[1:2]],lty=2);abline(h=y[a1[1:2]],lty=2)
points(x[a1[1]:a1[2]],y[a1[1]:a1[2]],pch=19,cex=0.5,col='blue')
#