# NOT RUN {
#
## Legendre polynomial 5th order
f=function(x){(63/8)*x^5-(35/4)*x^3+(15/8)*x}
x=seq(-1,1,0.001);y=f(x)
plot(x,y,pch=19,cex=0.5)
abline(h=0)
rall=scan_curve(x,y)
rall$study
rall$roots
## x1 x2 chi yvalue
## [1,] -0.907 -0.905 -9.060000e-01 1.234476e-03
## [2,] -0.540 -0.537 -5.385000e-01 7.447856e-05
## [3,] -0.001 0.001 5.551115e-17 1.040844e-16
## [4,] 0.537 0.540 5.385000e-01 -7.444324e-05
## [5,] 0.905 0.907 9.060000e-01 -1.234476e-03
rall$extremes
## x1 x2 chi yvalue
## [1,] -0.766 -0.764 -0.765 0.4196969
## [2,] -0.286 -0.284 -0.285 -0.3466274
## [3,] 0.284 0.286 0.285 0.3466274
## [4,] 0.764 0.766 0.765 -0.4196969
rall$inflections
## x1 x2 chi yvalue
## [1,] -0.579 -0.576 -5.775000e-01 9.659939e-02
## [2,] -0.001 0.001 5.551115e-17 1.040829e-16
## [3,] 0.576 0.579 5.775000e-01 -9.659935e-02
#
# }
Run the code above in your browser using DataLab