You are on page 1of 16

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/317169647

RootsExtremaInflections Demo

Presentation · May 2017


DOI: 10.13140/RG.2.2.13376.53765

CITATIONS READS
0 434

1 author:

Demetris Christopoulos
National and Kapodistrian University of Athens
88 PUBLICATIONS   115 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Coronavirus data analysis View project

Cryodynamics View project

All content following this page was uploaded by Demetris Christopoulos on 26 May 2017.

The user has requested enhancement of the downloaded file.


RootsExtremaInflections Demo
Demetris T. Christopoulos
email dchristop@econ.uoa.gr
May 26, 2017

Load package with its dependencies and some available data:

library(RootsExtremaInflections)
data(xydat)

Extract x and y variables:

x=xydat$x;y=xydat$y

Find root, plot results, print Taylor coefficients and rho estimation for a single root:

b<-rootxi(x,y,1,length(x),5,5,plots=TRUE);b$an;b$froot;

## 2.5 % 97.5 % an
## a0 -0.4042465 -0.2625694 -0.3334079
## a1 35.6234510 36.8668363 36.2451436
## a2 8.2921797 17.8057689 13.0489743
## a3 -158.4665008 -136.7277559 -147.5971284
## a4 -95.9817375 11.4260406 -42.2778484
## a5 31.0401819 220.5978720 125.8190270
## [1] 38.0000000 0.6043344

Let’s proceed now to multiple root finding by creating proper data:

f=function(x){3*cos(x-5)};xa=0.;xb=9;
set.seed(12345);x=sort(runif(101,xa,xb));r=0.1;
y=f(x)+2*r*(runif(length(x))-0.5);
plot(x,y,pch=19,cex=0.2,col='blue');abline(h=0)

The first root is

b1<-rootxi(x,y,1,20,5,5,plots=TRUE);b1$an;b1$froot;

## 2.5 % 97.5 % an
## a0 -0.09380972 0.03295954 -0.03042509
## a1 -3.63025679 -2.89908741 -3.26467210
## a2 -0.90435090 0.80658742 -0.04888174
## a3 -1.27911360 6.88168053 2.80128346
## a4 -8.77763032 2.51983279 -3.12889877
## a5 -1.10798564 3.38419904 1.13810670
## [1] 5.0000000 0.3108189

Compare it with the actual ρ1 = 0.2876110196 The second root now is

1
Data for [0.11,0.898]
Taylor Regression n = 5 , a = 5 % Plot of all available |α0|
7.738 Find root

7.661
● ●●
● data ●●
●●
● |α0|
●● ●



● ● ●
● ●●
4.821

6.195
● ● ●●
● ●
● ●
● ●




● ● ●
● ●

● ●
● ●

4.73
● ●




● ●

|α0|

Taylor fit (5 ) ●
● ● ●
y

● ●
−1.013

root

3.264
● ●


●● ●

● ●
●●●
● ●

● ●

1.799
● ●
●●
● ● ●
● ● ●
● ●
● ● ●
●●●
●● ●
−6.848

0.333
● ● ●

●● ● ● ●●
●● ●

● ● ●
0.108

0.604

0.898

0.108

0.604

0.898
x ρ

Figure 1: Find Single Root

b2<-rootxi(x,y,20,50,5,5,plots=TRUE);b2$an;b2$froot;

## 2.5 % 97.5 % an
## a0 0.1483905 0.2377617 0.193076089
## a1 2.9024852 3.0936024 2.998043835
## a2 -0.2053120 0.2220390 0.008363525
## a3 -0.5845597 -0.3426017 -0.463580702
## a4 -0.2431038 0.1136244 -0.064739689
## a5 -0.0893246 0.0687848 -0.010269897
## [1] 19.000000 3.493296

You have to compare it with the actual value of ρ2 = 3.429203673. Finally the third root can be found
and is

b3<-rootxi(x,y,50,90,5,5,plots=TRUE);b3$an;b3$froot;

## 2.5 % 97.5 % an
## a0 -0.002269152 0.058784414 0.0282576308
## a1 -3.090980046 -2.938875341 -3.0149276930
## a2 -0.089893659 0.075094637 -0.0073995112
## a3 0.403040978 0.591836654 0.4974388159
## a4 -0.035442477 0.037165754 0.0008616385
## a5 -0.048414145 0.005815106 -0.0212995192
## [1] 23.000000 6.567948

Just compare it with the actual value of ρ3 = 6.570796327

2
3

● ●

●● ● ● ●

● ●●


2

● ●
● ●




1





● ● ●

● ●
●●

0


y


● ●


● ●●


● ●

−1


● ●




●●

● ●●






● ●
● ●
● ●

● ●
● ● ●
● ●

−3

● ●
● ● ● ●
● ●
● ●
● ● ● ● ●

0 2 4 6 8

Figure 2: Three Roots

Data for [0.01,1.611]


Taylor Regression n = 5 , a = 5 % Plot of all available |α0|
Find root
0.845

2.913

● ●
● ● data ● |α0| ●

●●

● ●
0.097

2.337




1.76




|α0|


Taylor fit (5 )
y

−1.400

root
1.184

●●
●●




0.607

● ●


● ●

● ●

−2.897

0.03



● ●
0.010

0.311

1.611

0.010

0.311

1.611

x ρ

Figure 3: Find Multiple Roots (1)

3
Data for [1.61,4.521]
Taylor Regression n = 5 , a = 5 % Plot of all available |α0|
Find root
2.728

2.996
● ●●
● data ●
● ●
● ●

● |α0|

● ●
● ●●
●●
1.567

2.435

●●

● ●

1.875
●● ●
● ●

|α0|

Taylor fit (5 ) ●
y

●●
−0.755

root ●

1.314
● ●



● ●



0.754
● ●




● ●
−3.077

0.193
●● ● ● ●
●● ●
● ● ●
1.611

3.493

4.521

1.611

3.493

4.521
x ρ

Figure 4: Find Multiple Roots (2)

Data for [4.52,8.137]


Taylor Regression n = 5 , a = 5 % Plot of all available |α0|
Find root
3.021

3.009

● ● ●
●●●
● ●

● data ● |α0| ●

●● ●


● ●●● ●

●●

1.811

2.413



● ●



● ●

1.816


● ●

●●

|α0|

Taylor fit (5 ) ●



y


●●
−0.608

root
1.22


● ●
●●
● ●

● ●

0.624


● ●


● ●

● ●


−3.027

0.028

● ●
● ● ●●
●● ●
4.521

6.568

8.137

4.521

6.568

8.137

x ρ

Figure 5: Find Multiple Roots (3)

4
Now we continue to find extrema. Lets’s load available demo data

x=xydat$x;y=xydat$y

and find a single extreme point, plot results, print Taylor coefficients and rho estimation:

c<-extremexi(x,y,1,length(x),5,5,plots=TRUE);c$an;c$fextr;

## 2.5 % 97.5 % an
## a0 -6.778082 -6.6276938 -6.7028879
## a1 -1.611186 0.1275498 -0.7418182
## a2 85.152457 93.4939305 89.3231936
## a3 -11.389929 33.5321572 11.0711142
## a4 -318.711699 -136.0239437 -227.3678214
## a5 31.040182 220.5978720 125.8190270
## [1] 18.0000000 0.3101182

Data for [0.11,0.898]


Taylor Regression n = 5 , a = 5 % Plot of all available |α1|
Find extreme

36.626
7.738

● ● ●●


● data ●●
●●
● |α1| ●● ●
●● ●







4.821



● ●

● ●
● ●
● ●
● ●

22.272





● ●




|α1|


Taylor fit (5 ) ●
● ●
y



● ●
−1.013

extreme ● ●

●● ●
● ● ●●
●●● ●
● ●
7.919


●● ● ●
● ●
● ● ●

● ●
● ● ●
● ●
●●● ●
●● ● ●
−6.848

0.742

● ●
●● ● ● ●●
●● ●

● ● ●
0.108

0.310

0.898

0.108

0.310

0.898

x ρ

Figure 6: Single Extreme

Now we find multiple extrema, after creating proper data:

f=function(x){3*cos(x-5)};xa=0.;xb=9;
set.seed(12345);x=sort(runif(101,xa,xb));
r=0.1;y=f(x)+2*r*(runif(length(x))-0.5);
plot(x,y,pch=19,cex=0.2,col='blue');

The first extreme point is

5
3

● ●

●● ● ● ●

● ●●


2

● ●
● ●




1





● ● ●

● ●
●●

0


y


● ●


● ●●


● ●

−1


● ●




●●

● ●●






● ●
● ●
● ●

● ●
● ● ●
● ●

−3

● ●
● ● ● ●
● ●
● ●
● ● ● ● ●

0 2 4 6 8

Figure 7: Three Extrema

c1<-extremexi(x,y,1,40,5,5,plots=TRUE);c1$an;c1$fextr;

## 2.5 % 97.5 % an
## a0 -3.02708631 -2.94592364 -2.986504975
## a1 0.07660314 0.24706531 0.161834227
## a2 1.42127770 1.58580632 1.503542012
## a3 -0.09037154 0.10377241 0.006700434
## a4 -0.14788899 -0.08719428 -0.117541632
## a5 -0.03822416 0.01425066 -0.011986748
## [1] 22.000000 1.917229

Compare it with the actual ρ1 = 1.858407346


The second extreme point is

c2<-extremexi(x,y,50,80,5,5,plots=TRUE);c2$an;c2$fextr;

## 2.5 % 97.5 % an
## a0 2.89779980 3.064703163 2.9812515
## a1 0.27288720 0.541496278 0.4071917
## a2 -1.81454401 -0.677932480 -1.2462382
## a3 -1.76290384 0.216201349 -0.7733512
## a4 0.02548354 1.269671304 0.6475774
## a5 -0.25156866 0.007565154 -0.1220018
## [1] 7.000000 4.896521

Compare now the real value of ρ2 = 5.0


Finally the third extreme point is

6
Data for [0.01,3.521]
Taylor Regression n = 5 , a = 5 % Plot of all available |α1|
0.845 Find extreme

3.082
● ● ● ●●
● ● data ●● ● ● |α1|
● ●
● ● ●●

● ●
● ●

● ●
● ●
0.061

2.498


● ● ●


● ●●
● ●

1.914


● ●

|α1|
Taylor fit (5 )
y


● ●
−1.508

extreme

1.33

● ● ●
● ●


● ●

0.746


● ●


● ● ● ●
● ●
−3.077

● ●

0.162
● ●
● ●●
● ●
0.010

1.917

3.521

0.010

1.917

3.521
x ρ

Figure 8: Find Multiple Extreme (1)

c3<-extremexi(x,y,80,length(x),5,5,plots=TRUE);c3$an;c3$fextr;

## 2.5 % 97.5 % an
## a0 -3.0637461 -2.9218614 -2.9928037
## a1 -0.2381605 0.2615635 0.0117015
## a2 0.7860259 2.0105383 1.3982821
## a3 -1.4187417 0.7472155 -0.3357631
## a4 -0.7943208 1.0876143 0.1466468
## a5 -0.6677733 1.7628833 0.5475550
## [1] 11.000000 8.137392

Keep in mind that the actual value is ρ3 = 8.141592654

7
Data for [4.52,7.124]
Taylor Regression n = 5 , a = 5 % Plot of all available |α1|
Find extreme
3.021

3.045
● ●
●● ●
● data ● |α1| ●
●●●● ● ● ●
●●
●● ●●● ● ●● ●

● ●


2.088

2.518

● ●


1.155

1.99


|α1|
Taylor fit (5 ) ●
y


extreme ● ●
0.222

1.462








0.935



●●●
●●



−1.643

0.407
● ●
4.521

4.897

7.124

4.521

4.897

7.124
x ρ

Figure 9: Find Multiple Extreme (2)

Data for [7.12,8.908]


Taylor Regression n = 5 , a = 5 % Plot of all available |α1|
Find extreme
2.8

●● ●
● data ● |α1|

−1.907

2.242

● ●

● ●●


1.685


● ●
● ● ●●
|α1|

Taylor fit (5 ) ●
y


−2.467

extreme
1.127



● ●



● ●
0.569





●●
● ●
−3.027

0.012

● ●

● ●
7.124

8.137

8.908

7.124

8.137

8.908

x ρ

Figure 10: Find Multiple Extreme (3)

8
Finally we are going to find inflection points, first for available demo data

x=xydat$x;y=xydat$y

Find single inflection point, plot results, print Taylor coefficients and rho estimation:

d<-inflexi(x,y,1,length(x),5,5,plots=TRUE);d$an;d$finfl;

## 2.5 % 97.5 % an
## a0 0.6464691 0.784573 0.7155210
## a1 35.9261150 37.325631 36.6258731
## a2 -4.7633889 5.050487 0.1435489
## a3 -162.2798131 -140.556443 -151.4181281
## a4 -90.7953845 42.399919 -24.1977330
## a5 31.0401819 220.597872 125.8190270
## [1] 41.0000000 0.6330743

Data for [0.11,0.9]


Taylor Regression n = 5 , a = 5 % Plot of all available |α2|
Find inflection
7.738

● ●
● data ●●
●●
● |α2| ●
●●


85.718


4.821


● ● ●
●●
●● ●


● ●

● ● ●
● ●



● ● ●
● ●


● ●



|α2|

Taylor fit (5 ) ●
● ●

● ●
y


−1.013

inflection
42.931

● ● ●

● ●
●●


● ●
●●● ●
● ●

● ●

● ●
●●
● ● ●
● ●


● ● ●
●●● ●
●● ● ●

−6.848

0.144

● ●
●● ● ● ●●
●● ●

● ● ●

0.108

0.633

0.898

0.108

0.633

0.898

x ρ

Figure 11: Single Inflection

Find multiple inflection points for non equidistant noisy data:

f=function(x){3*cos(x-5)};xa=0.;xb=9;
set.seed(12345);x=sort(runif(101,xa,xb));
r=0.1;y=f(x)+2*r*(runif(length(x))-0.5);
plot(x,y,pch=19,cex=0.2,col='blue');

The first inflection point is

9
3

● ●

●● ● ● ●

● ●●


2

● ●
● ●




1





● ● ●

● ●
●●

0


y


● ●


● ●●


● ●

−1


● ●




●●

● ●●






● ●
● ●
● ●

● ●
● ● ●
● ●

−3

● ●
● ● ● ●
● ●
● ●
● ● ● ● ●

0 2 4 6 8

Figure 12: Two Inflection Points

d1<-inflexi(x,y,20,50,5,5,plots=TRUE);d1$an;d1$finfl;

## 2.5 % 97.5 % an
## a0 0.1483905 0.2377617 0.193076089
## a1 2.9024852 3.0936024 2.998043835
## a2 -0.2053120 0.2220390 0.008363525
## a3 -0.5845597 -0.3426017 -0.463580702
## a4 -0.2431038 0.1136244 -0.064739689
## a5 -0.0893246 0.0687848 -0.010269897
## [1] 19.000000 3.493296

Compare it with the actual ρ1 = 3.429203673.


The second inflection point is

d2<-inflexi(x,y,50,length(x),5,5,plots=TRUE);d2$an;d2$finfl;

## 2.5 % 97.5 % an
## a0 -0.000875677 0.057156356 0.0281403394
## a1 -3.058363342 -2.942026810 -3.0001950762
## a2 -0.056224101 0.044135857 -0.0060441222
## a3 0.433135897 0.528446241 0.4807910691
## a4 -0.011774733 0.012002414 0.0001138404
## a5 -0.026899286 -0.009520899 -0.0182100925
## [1] 23.000000 6.567948

You have to compare it with the actual value of ρ2 = 6.570796327

10
Data for [1.61,4.52]
Taylor Regression n = 5 , a = 5 % Plot of all available |α2|
Find inflection
2.728

1.943
● ● ●
● data ●


● |α2| ●


●●
1.567

1.556




●● ●

1.169


●●

● ●

|α2|

Taylor fit (5 ) ●
y

●● ● ●
−0.755

inflection

0.782
● ●


● ●
● ●

● ● ●

0.395
● ●

● ●

● ● ●
−3.077

0.008

●● ●
●● ●
● ●

1.611

3.493

4.521

1.611

3.493

4.521
x ρ

Figure 13: Find Multiple Inflections (1)

Data for [4.52,8.91]


Taylor Regression n = 5 , a = 5 % Plot of all available |α2|
Find inflection
3.021

1.565

● ● ●
●● ●

● data ● |α2| ● ●
●●●
● ● ●

● ● ●
● ●

● ● ●
● ●
● ●
1.811

1.253



● ●





● ●


0.941

● ●


●● ●


|α2|

Taylor fit (5 ) ●

y

● ●
● ●
−0.608

inflection ●
0.629

● ●
●● ●
● ●



0.318



● ●
● ●
● ●


● ●
● ●
● ●

−3.027

● ●●
0.006

● ●
● ● ●● ●●
●● ● ● ●
4.521

6.568

8.908

4.521

6.568

8.908

x ρ

Figure 14: Find Multiple Inflections (2)

11
Now let’s find root, extrema and inflection point with a single command. Let’s create some data:

f=function(x){3*cos(x-5)+1.5};xa=1.;xb=5;
set.seed(12345);x=sort(runif(5001,xa,xb));
r=0.1;y=f(x)+2*r*(runif(length(x))-0.5);
plot(x,y,pch=19,cex=0.2,col='blue');abline(h=0)

●●●
●● ●●● ●●●●● ●
●●
● ● ●● ● ● ● ●● ●
● ●

●● ●●●● ●● ●●●
●●●● ●
● ●●
●●● ●●
● ●●●
● ●●
●● ●●●● ● ●● ● ●●

● ●●●
●● ● ●
●●
●●●●●
●●
●●●●● ●● ●●●●● ●●● ● ● ● ●● ●

●● ● ● ●● ● ●● ●● ● ●● ●● ●●● ●●
●●●●●●● ●●●●●●●
●●●● ●●●
●●● ●●● ● ●●●

● ●●●●●●●
●●● ● ●
●●●● ●
●●
● ● ●●●●● ●●
●●
●●●
● ●● ● ●
●●● ●● ●●●●●●
● ● ●●●●
● ●●●●
●●●● ●●● ●● ●
● ●● ●●
●●●●
●●●

●●
●● ●
●●
● ●●
●●●● ●●●●

●●

●● ●
●● ●●
●●●●●●● ●
● ●●
●● ●●● ●●●
●● ●●● ●●●● ●●●●
●●●●●●
●●●●● ● ●
●●●●●● ●● ●● ● ●●●● ●●●
● ●

●● ●
● ● ●●● ● ● ●●
●● ● ● ●●● ●●●●●
●● ●● ●●
●●●●
●● ●
●●●● ●●●
● ● ● ●● ● ●●
●● ●● ● ●
●●●●●● ● ●●●● ● ●
●●
●● ● ● ● ●
● ●
● ●●● ●●
●● ● ●●●
● ●
●●
●●
● ●●● ●
●●●● ● ● ●●
● ●●●
● ● ●●
● ●●● ●●●
● ● ●● ●●
● ● ● ●
●● ●
● ● ●●● ● ●●
● ● ●●● ●● ●●●
●●
●●
● ●● ●●●● ●●
●●

● ●
●●
●● ● ●●●● ●
●● ●
●●


●●● ●●● ●●●●
● ●●
●● ●● ●
● ● ●●●●

● ● ● ●●●●●●
● ●●● ●●●●● ● ●

●●●●●●


●●●●●●● ●

●●● ●●
●● ●●
●● ●●●●
4

●●●● ●● ●● ●●●
●● ●
● ● ● ●● ●●●

●● ●●● ● ●●●● ● ●
● ● ●●
●●●
● ● ●●●
●●●●●●●●●● ● ●●


● ●●● ●●● ●●

●●●● ●●● ●●

●●● ●●
● ●●●
●●●●●
● ●

● ●●●● ● ● ●●●●

●● ●● ●● ●● ●●● ●
●●● ●●
●● ●● ●●
●●
●● ● ●●● ● ●
● ● ●●●
● ●●●●
●● ●● ●●


●●●●● ●● ● ●

●●●

● ●●
●● ●● ● ● ●●
●●
● ●●●●
● ●●●
●●
●●
●●
● ●●●●●●●

●●●●● ●
●●
●●●●●●●●●

●●
●●●
● ●
● ●●

● ●●
●●●●● ●
● ●●● ●●●
●●
●●●
●●● ●●●●
●●●●
● ● ●● ●

●●●
● ● ●● ●●


● ● ●●
●●

● ●●

●● ● ●

●●●●● ●●
●●●●
●●● ● ●●● ●●
●●
● ●●● ●
●●●
●●●

●● ●● ●
● ●●●●●●
● ●
● ● ●●● ●●●
●● ● ●●●
●●● ●
●●● ● ●●●
● ●●
● ●●
●● ● ● ●●
●●●● ●●
●● ● ●● ●
●●
●●
●●● ● ●●●●●●

●●
●● ●● ●
●●●●
●●●●

● ●●
● ●

●●
●●● ● ●
● ●●●●
● ●● ●●●
●●●
●●●●
●●●

●● ●● ●●

●●●



●●●●●● ●●●


●●●
●●●●●●●●●
●●● ●●●●●●
●●● ●● ●●
●●●●●
●●●●● ●
●●●●● ●●●
●●●●●●● ●●●●
3

●●
● ●●●●●
● ● ● ●
● ●●
● ●●
●● ●
●●
●●●
● ●● ●●● ●
● ●●●●●
●● ●
●● ●●●●●●●●●
●● ●●●● ●
●●
●●● ●●●

●●●●● ●
●●●●●● ●●●●●
●●●●●● ●
●●●
●● ●●
●●●

● ● ●●●● ●
●●● ●
●●
●● ●● ●●●
●●
●●●● ●
●● ●
● ●●
● ●●● ●●
●●●● ● ●
● ●●
●●
●●●●●●●●
●● ●
●●● ●●
●● ●●● ●●●
●●●●●● ●
●●●●●●●● ●●●
●●
●● ●
●● ●●●●

● ● ●
●●●
●● ●●● ●

●●● ● ● ●●
●●
●●●●●●●

● ●●
●● ●●●● ●●
●●●●● ●●● ●
●● ●● ● ●● ●

●●
● ●
●●●●● ●

● ●●●● ●●●●●
●● ●●
●●
● ● ●●●●●
● ●●
●●●● ●● ●●
●●

● ● ●
●●●●
● ● ●●

● ●
● ●●●●

● ●●●
●● ●●●
● ●● ●●● ●●
● ● ●●

●●●●
●● ●●●●
●● ●
●●
●●●● ●
●●●●●●
●●●●
●● ●●●●

●●● ●





● ● ●
●● ●●●● ●●
2

●●●● ●●
● ●
●● ●
●●● ●
●●●
●●● ●● ●●
●●● ●
● ●
●●
●●●


● ● ●● ●●
●●● ●●●
●●
● ●● ●
●●●●●●●

●●●

●●
● ●●●●●
●● ●
● ●
●●●●

●●●

●●● ●
● ●
● ●●
● ●●
● ●●


●●●
●●●
● ●● ●

●●

●●●●
● ●●

●●
● ●●

● ●●

● ●●●
●●●●
●● ●
●●● ●
●●● ● ●
●●
●● ●● ●
●●

●●
●● ● ●●●●●
●●●
y

●●
●●●●● ●

●● ●




●● ● ●●● ●

●●
●●●
● ● ●
●● ●
●● ●● ●●●


●●
● ●●●
●●● ●● ●
●●
●● ●
● ● ●●
●●
●●●●
●●●
●●●
●● ●●
●●● ●

●●●●●● ●
●●●●●
●●● ●●
●● ●
●●●●●● ●●
●● ●

●●●●● ● ●

●● ●●

●●●●
●● ●●●●
●●
●●

● ● ●●
● ● ●
●●●●● ●
● ●
●● ●● ●


●●●●●
●●● ●
●● ●
● ●●
● ●●●

●●●●●
1

●● ● ●
● ●

●●●●●
●●●●

●●●●● ●●
●●●
●● ●●
●● ●●

●●
●●● ● ●●


●●●
● ●● ●●●●

●● ●
●●
● ● ●●
●● ● ●
● ●
●●● ●
●●

●●● ●●●


● ● ●● ●
● ●
●●
●● ●●●
●●●● ● ●

●●
● ●●●● ●●●●
●● ●● ●● ●
●● ●●
● ● ●
●● ●
●● ●●
●●
● ●●●●●●●
● ●●●●● ●
●●●●
●●
● ●●
●●●●●●
●●●● ●

●● ●
●●

●●●
●●●●
●● ●
●●
●●●●●●●
●● ●● ●
●●● ●
● ● ●●●●●
●● ●
●● ● ●● ●

●●● ●


● ●● ●●●
●●
●●● ●
●● ●● ●
●●
● ●●
●●●●
● ●●●●

●●
●●
●●●

● ●●●●

●●
● ●● ●
●●● ● ●●●●

●● ● ●
●●●●●●
●●●●
●●●●●●●●●●●●
●● ● ●
●●● ●●●●●

● ●●●●●●
● ●
● ●●
● ●●●●

● ●
● ●●●●
●●●●
●●●●
● ●●● ●
●●● ●●●
● ●● ●
● ●
●● ●● ●
●● ●● ●●●
●●



●●●●● ●●●●
0

●●●● ●●
● ●

●● ●●●●
● ●●

●●

● ●●● ●

●●
● ●●

●●● ●● ●
●● ● ● ●●
●● ●

●●● ●●

● ●● ●● ●
●●●● ●●●● ●● ●
●● ● ●● ●●

●●●●
●●●● ●●●
●● ●
●●●● ●●●
●● ●
●● ● ● ● ●
●● ●●
●●
● ●
●●
●●●● ●●


● ● ●
● ● ●
●● ●●● ●
●●●

● ●● ●
●● ●● ●●●
● ●

●●●● ●● ●
●●●
●●●●●● ●●● ●
●●

● ●

●●●●●●

●●

● ●●
●●

● ●



●●●●●● ● ●●
● ● ●● ●●● ●
●● ●
●● ●●●●● ●

●● ●●●●
● ●●
● ● ●●● ●●
●●
● ●●
●●
● ●● ● ● ● ●●


●●● ●●● ●●●●● ●●●●
●●●
● ●●●●
●●●

●●● ●●●●●●●● ● ●

●● ●● ●●
● ●●●● ●●●
●●●●●● ●● ●
● ●● ● ●● ● ● ● ●
● ●
● ● ●● ●● ●●●
●●●●
●●●●●●



●●●●●●
● ●●
●●
●●● ●●

● ●● ●●
● ●●● ●
●●●●
●●

● ●● ●●● ●
●● ●
●● ●●●●●●●●●●
●●●●

● ● ● ●● ● ● ●● ●●●●●●●
●●●●●
●● ●●● ●● ●●●
●●
●●
●●●● ●●●●●●
●●●●
● ●●
●●●●●
● ● ● ●●
● ●●●
●● ●●● ●

●●●● ●
●●●
● ●● ● ●●●●
●●● ●
● ● ●●●●●● ● ●●●●
●●● ●●

● ●●● ●● ● ●●● ●● ●●●●● ● ●
●●
● ●●●●
●● ●● ●●● ● ● ●●●●●
●● ●● ●
●●●●●● ●
●● ●●
●●
●●●
●●●
●●
● ●●●●●
●●
●● ●●●● ●● ●●● ●
● ●
●● ●
●●●●


●●
● ●● ●
●●● ●● ●●●● ● ●● ●● ●●●●●
●●
● ●● ●● ●● ●● ●●●● ●
● ● ●● ●●
●● ●
● ●● ●●●
●●●●●● ● ●

● ●●● ●●● ● ●
●● ● ●●● ● ●●
−1



●● ●● ●● ●● ●●●●●
●● ● ● ● ●●●●●●●
●●● ● ●
● ●●
● ● ●●● ●● ● ●● ●
● ●●
●●● ●● ●●●

●● ●●● ● ●
●● ●●●●●●● ●●●
●● ● ●●●●


●●
● ●●●●●
● ●
●●● ●●●●
●● ●●●●● ● ● ●● ●●
● ●
●● ●●●● ●
● ●
●● ●●● ● ●●
●●●● ●●● ● ●
●● ●●●
● ● ●
●●

● ●
● ●●● ● ●●● ● ● ●

● ●● ●● ●
● ●●
● ●● ● ●●●●
● ●●●●
● ● ●●●●●●●● ●

●● ●● ●●● ●●●●
● ●●● ●●
● ● ● ●
●● ● ● ●● ● ●●●● ● ● ● ●
●● ●● ● ●●●● ● ● ●●●
● ●●● ●●●
●● ● ● ●● ●

●●
●● ● ● ● ●
●●
●●



●●
●●● ● ●●●
●● ●●●●
● ●●●●●●


●●● ● ●●●●●
●●● ● ● ●●●●●● ●●● ●
●● ●
● ● ● ● ●● ●●●● ●●● ● ●●●
●● ●● ●● ●●● ● ●●●

●●●●●● ●
●● ● ●●●

●● ● ●●●●● ●●●
●● ● ●●●●●● ● ●●

●● ●●●●●
●●● ● ●●●● ●●● ●● ●●●●


●●●●●● ●
● ●●● ●●● ●● ●●●●●●
●●
●●●●●● ●●●

●●●● ● ●
● ●
●●
●● ●●

●●● ●●●●●●
● ●
●●●●
●●●●●●●● ● ● ●● ●●● ●●●● ● ●
● ●●●●● ●
●●●●

● ●● ●● ●

●●●●●●● ● ●●● ● ● ● ●
● ● ●●●

● ● ●● ●
●●●●●
●●●●●●●●
●● ● ●● ●●● ● ●●●● ●●●●●●●●
● ●●●●● ●● ● ●●●●●● ●●● ●
●●●●●●● ●
●●

●●● ●● ●
●●●● ●● ● ●●
●● ●● ●
●●●● ● ●●
●●●
●● ●●●
● ●
●● ●●●●●
●●●●●
● ●● ●
●● ● ●●
●●●● ●●● ●●● ● ●
● ●

● ● ●● ● ●●●●●●● ●●●●
● ●● ●●●
●●●●●


●●●●●●● ●

●●● ●● ● ● ● ●● ●●● ●●● ●●
● ●● ●●●●
●● ● ●● ●● ●●●●●
●●
●●●●

● ●
●●●


●●●● ●●

●●●●● ●

● ● ●
●●● ●●●● ●●●●●● ●●●● ●
● ●● ● ● ●●
●● ●●● ●●● ●●
●● ●●● ●●●●● ●●● ● ● ●●●●●● ● ●● ● ●
●●
●●●●● ●● ●● ●
● ● ● ●●●● ●● ●
●● ●●●●●●
●● ●● ● ●●● ●● ● ●●● ●● ● ●●

●●● ●● ● ●●●●●●● ●● ● ●
●●●●●● ●●●●●●● ● ●●
●●●● ●
● ● ● ● ● ● ●●● ● ●
●●● ● ●● ●●● ● ● ●● ●● ●●●●●
●●
●●●
● ●●
●● ● ●
●●●●●●● ●●●
● ● ●●●●●●●
●●●●
●●
●● ● ●●●●
●●
●● ●
●● ●●●●
●●●● ● ●●●

●● ●● ●
● ●●●
●● ●● ●● ●●●


● ●● ●
●●●●●●●
● ●●●●● ●●●●● ●● ● ● ●● ● ● ●●● ●●● ●● ● ●●● ●● ● ●●● ●
● ● ●
●● ●●● ● ●● ●●●
●● ●● ● ● ●● ●● ●● ●
●●●●
● ●●●●
●● ●●
● ●●● ● ●●●●
●● ●●
●●●● ●
● ●● ●
●●●●●
●●
●● ●●●
● ●● ●●●●●●
●●●
●●● ●●● ● ●●●
●●

● ●●● ● ●


●● ●●●●
● ●●●●●●●
● ●●●

● ● ● ●●●● ●●●●●● ● ●●● ● ● ● ●● ●
●●● ●● ● ●
●●●● ●● ●● ●● ●●●●● ● ●
●●●●●● ●●● ●●
●●● ● ● ● ●● ● ●●●
●● ● ●●●●
● ●●● ●●●

● ●●● ●
●●● ●●●●●● ● ●●●●●
●●
● ●● ●
● ● ● ●●●●●●● ●
● ●●●

●●


●●
●●
●● ●
●●●
●●

●●
●●●
●●●●● ●●●● ●●●●●●● ●

●●●●
●●●● ●● ●● ●● ●●●●
●●
● ● ● ●
●●
● ●●●● ●● ● ●● ●
● ●●●
● ● ● ● ● ●●● ●

1 2 3 4 5

Since we have many points it is preferable to use parallel computing now:

a<-rootexinf(x,y,1,length(x),5,doparallel = TRUE);a$an0;a$an1;a$an2;a$frexinf;

## Available workers are 12


## Time difference of 12.78117 secs
## 2.5 % 97.5 % an0
## a0 -0.004165735 0.001838624 -0.001163555

12
## a1 2.588990973 2.600915136 2.594953055
## a2 0.731456294 0.741262772 0.736359533
## a3 -0.435591038 -0.423837041 -0.429714040
## a4 -0.052926049 -0.050039975 -0.051483012
## a5 0.017915715 0.020538155 0.019226935
## 2.5 % 97.5 % an1
## a0 -1.507117843 -1.500375848 -1.5037468451
## a1 -0.008343275 0.007916087 -0.0002135941
## a2 1.519432687 1.534103788 1.5267682378
## a3 -0.017663080 0.007780728 -0.0049411760
## a4 -0.159461025 -0.144303367 -0.1518821962
## a5 0.017915715 0.020538155 0.0192269354
## 2.5 % 97.5 % an2
## a0 1.503394727 1.509925166 1.5066599466
## a1 2.985374546 2.995259021 2.9903167834
## a2 -0.009041165 0.005898692 -0.0015712367
## a3 -0.489107253 -0.480579585 -0.4848434187
## a4 -0.003885327 0.002364758 -0.0007602842
## a5 0.017915715 0.020538155 0.0192269354
## index value
## root 2364 2.903791
## extreme 1057 1.859431
## inflection 3038 3.431413

You have to compare with the exact values root = 2.905604898, extreme = 1.858407346 and in f lection =
3.429203673.

13
Data for [1,4.999]
Taylor Regression n = 5 , a = 5 % Plot of all available |α0|
Find root


●●
●●
●●
●●


●●

●●



●●



●●


●●




●●




●●
● ●


●●


●●

●●


●●


●●


●●

●●


●●


●●



●●
●● ●

●●

●●● ●●●

● ●
●●



● data ●


●●

●●





































































































●●



●●

●●



●●



●●
●●

●●


●●

●●
●●

● ● |α0| ●

●●


●●


●●


●●


●●


●●


●●


●●


●●



●●



●●

●●



●●



●●
●●
●● ●


●●


●●
●●
●●

●●



●●



●●
●●

●● ●

●●



●● ●

● ●
3.357

●● ●

3.357

●●


●●


●●

●●

●●
● ●●


●●


●●

●●


●●


●●




●●

●●
● ●


●●


●●


●●


●●



●●


● ●


●●



●●
●●




●●

●●



●●
● ●
●●



●●
●●

●●



●●

●● ●●

●●

●●

●●


●●




●●

●●

● ●

●●




●●



●●



●●


●● ●●

●●
●●

●●



●●




●●

●● ●
●●




●●
●●




●●

●● ●

●●

●●



●●

●●



●● ●●



●●

●●




●●

●●
●● ●

●●



●●




●●
●●

● ●


●●

●●



●●


●●


●●
● ●●



●●


●●



●●



●● ●
●●




●●
●●



●●
● ●

●●

●●

●●




●●


●● ●




●●


●●



●●
● ●●


●●



●●


●●

●● ●
●●


● ●
● ●

|α0|
●●

●●


●●
●● ●


Taylor fit (5 ) ●●












































●●
y


●●


●●




●●


● ●●




●●
●●

●● ●
0.879

0.879
●●

●●


●●



●● ●

●●
root ●






















































●●














●●


●●●


●●


●● ●
●●




●●

●●

●●

● ●
●●



●●




●●



●●

● ●
●●


●●



●●


●●



●● ●


●●


●●

●●


●●

●●


●●

●●


●●


●●

●●
● ●

●●



●●



●●

●●
● ●
●●
●●


●●


●●


●●


● ●●


●●

●●


●●

●●


●● ●

●●




●●





●●

●● ●●

●●


●●

●●
● ●
●●


●●


●●

● ●


●●

●●



●●




●●
● ●●


●●

●●

● ●●


●●


●●
● ●



●●
●●



●●

●●
● ●

●●

●●

● ●
●●


●●


● ●●



●●


●●



●●


●●
●● ●


●●


●● ●


●●

●● ●●

●●


●●



●●


●●

●● ●●


●●

● ●

●●

●● ●●




●●



●●

●●●
● ●●


●●
● ●

●●

●● ●
●●

● ●

●●
●●



●●




●●● ●●


●●
● ●

●●


● ●
●●



●●


●● ●


●●

●●



●●


● ●


●●
● ●


●●

● ●

●●



●●

●●



●●



●●
● ●●

●●


●●


●●


●●
●●
● ●

●●

● ●●


●●
● ●


●●


●●

●●

●●


●●



●●


● ●

●●


●●




●●



●●

●● ●
●●

●● ●
●●


● ●





●●

●●


●●


●●

●●

●● ●
●●

●●


●●




●●


●●

●● ●


●●
● ●

●●
● ●



●●



●●

●●

●●


●●
● ●
●●

●●


●●


●●


●●


●● ●
●●


● ●
●●


● ●●




−1.599

−1.599
●●

●●



●●



●●

●●


●●● ●●

●●




●●


●●

●●


●●
● ●
● ●


●●
● ●●



● ●


●●
●●


●●



●●


●●



●●

●●

● ●●

●●


●●



●●

●●




●●

●● ●
●●

● ●

●●

●●
●●




●●
●●


●●

●●

●●


●●
● ● ●●

●●



●●




●●

●●


●●


●●



●●
● ●

●●
● ●


●●
●●


●●




●●



●●


●●


●●


●●

●●

●●

●●
●●
●● ●●
●●
●●

●●



●●

●●


●●

●●


●●

●●


●●

●● ●
●●

● ●●


●●

●●

●●
●●


●●

●●


●●



●●


●●

●●



●●

●●

●●


●●

●●
●●

●●

●●

●●

●●●
●●

●●
●●



●●

●●


●●


●●


●●


●●


●●


●●



●●

●●
●● ●


● ●



●●
●●
●●
●●



●●


●●


●●
●●




●●


●●


●●

●●


●●




●●



●●



●●



●●

●●



●●


●●




●●



●●



●●

●●
●● ●

●●
●●●


●●
● ●
●●
●● ●
●●●
●●
●●
●●●
● ●
●●

1.002

1.801

2.600

3.400

4.199

4.999

1.002

2.904

4.999
x ρ

Data for [1,4.999]


Taylor Regression n = 5 , a = 5 % Plot of all available |α1|
Find extreme

●●

●●●
●●

●●



●●



●●



●●


●●




●●




●●
● ●
●●

●●


●●

●●


●●

●●


●●


●●


●●

●●


●●


●●


●●

●●


●●

●●

●●

●● ●
●●

●●
●● ●●●

● ●

●●
● ●
●●

● data ●

●●

●●



●●

































































































●●


●●



●●



●●


●●

●●

●●


●●

●●
●●

● ●

|α |



●●

●●


●●●


1●
● ●

●●


●●


●● ●●

●●


●●

●●


●●


●●


●●


●●



●●




●●

●●

●●



●●


●●
●● ●


●●
● ●●

●●



●●
●●



●●



●●


●●
●●
● ●

●●

● ●●

●●

●●● ●
●● ● ●

3.357


3.357

●●

●●



●●


●●

●●

● ●
●●

● ●

●●

●●
●●


●●



●●



●●

●●
●● ●●


●● ●
●●



●●

●●


●●



●●
●● ●
●●
● ●●


●●
●●

●●



●●

●●



●●

● ●

●●
● ●
●●



●●

●●



●●

●●
● ●


● ●●


●●●



●●


●●


●●
●● ●●

● ●●




●●



●●




●●

●●
● ●
●●

● ●



●●


●●



●●



●●● ●

●● ●


●●


●●





●●


●● ● ●

●● ●

●●



●●


●●


●●
●● ●

●●
● ●

●● ●

●●
●●


●●


●●




●●
● ●
●●

● ●

● ●
●●


●●

●●



●●

●● ●●


● ●

●● ●
●●


●●
●●




●●


● ●

●● ●

●● ●
●●


●●



●●



●●



●● ●

●● ●

●● ●
●●



●●

●●



●● ●
●●
● ●
●● ●
●●

●●



●●


●●

● ●
●●
● ●
●●
● ●
●●

●●

●●




●●

● ●●

● ●
●● ●
●●

●●
●●




●●


●●
● ●●

● ●
●●
● ●
●●
●●●
● ●● ●
● ●

|α1|

●●

●●


●●

●● ●
● ● ●●
Taylor fit (5 ) ●






























●●

● ●●

●●


●● ●






● ●
●●


●●


y


●●

●●


●●


●● ●
●●
● ●
●● ●●


●●

●●
●●
● ● ●● ●

0.879

0.879




●●


●●


●● ●●
● ●

● ●


extreme ●
●●




















































●● ●
●●


●●

●●


● ●











●●


●●


●●



●●
●●


●●

●●
● ●

● ●

● ●



●●




●●


●●

●● ●●
● ●
● ●


●●




●●


●●

●● ●● ●
●● ●
●●
●●

●●

●●



●●

●● ●

● ●●
● ●





●●



●●


●●● ●

● ●
● ●






●●




●●


●●
● ●

● ●

● ●●


●●



●●




●●
● ●● ●
●● ●
●●

●●
●●


●●

●● ●
●● ●●
● ●


●●


●●



●●



●●
●● ●

● ●
● ●


●●


●●



●●


●●

●● ●
● ●

● ●●


●●


●●


●●●
● ●●
● ●
●● ●


● ●

●●

●●




●●




●●

●● ●
●● ●
●● ●





●●


●●
● ●●


●●

●●




●●
● ●
● ●
● ●●



●●



●●



●●



●●

● ●●

●●





●●



●●



●●
●● ●

● ●

● ●●

●●

●●




●●

●●




●●

● ●
●●

●●



●●


●●


●● ●●
● ●● ●
●●


●●

●●



●●



●●

●● ●


●●

●●

●●





●●


●●


● ●● ●
● ●


●●


●●

●●

●●


●●
● ●●●


●●

●●
●●


●●
● ●

● ●

● ●

−1.599


−1.599

●●

●●



●●

●●





●●

●●● ●●


●●


●●

●●

●●●

●●
● ●
● ●

● ●
●●

●●
●●


●●




●●


●●



●●


●●

●●
● ●

●●

●●


●●

●●


●●




●●
●● ●
●● ●
●● ●

●●

●●



●●

●●

●●


●●


●●

●●● ●
●●


●●




●●



●●

●●


●●


●●


●● ●
●● ●● ●



●●



●●



●●




●●


●●




●●

●●

●●
●●


●●●
● ●
●●●
●●

●●



●●

●●





●●

●●



●●


●●



●●

●●
● ●
● ●

● ●●

●●
●●

●●



●●


●●

●●


●●



●●


●●


●●


●●



●●

●●
●●

●●

●●
●●

●●

●●

●●
●●
●●

●●



●●



●●




●●
●●


●●




●●

●●


●●


●●

●●
●● ●● ●
● ●

●●●

●●
●●

●●



●●


●●


●●

●●



●●



●●

●●


●●

●●



●●




●●



●●



●●


●●


●●


●●



●●



●●


●●
●● ●
●●
●● ●



●●●●
●●●●●
● ●

●●
●●
●●● ●
● ●●
1.002

1.801

2.600

3.400

4.199

4.999

1.002

1.859

4.999
x ρ

Data for [1,4.999]


Taylor Regression n = 5 , a = 5 % Plot of all available |α2|
Find inflection


●●
●●
●●
●●


●●

●●



●●



●●


●●




●●




●●
● ●


●● ●

●●


●●

●●


●●


●●


●●


●●
●● ●

●●

●●● ●●●
● ●
●●


●●


●●

● ●
●●


●●


●●

● ●

●●
● data ●

●●


●●


●●































































































●●



●●

●●

●●



●●
●●

●●


●●
●●

●●




●●

●●


●●

●●


●●

●●


●●

●●


●● ●●

●●

●●


●●

●●


●●


●●

●●


●●


●●

● |α |
2 ●●


●●


●●


●●


●●


●●

●●




●●

●●

●●


●●



●●


●●
●● ●
●●

●● ●
●●


●●
● ●


●●



●●

●●



●●




●●

●●

● ●


●● ●●


●●
● ●

●●


●●● ●
●● ● ● ●
3.357

● ●
3.357

●●

●●



●●


●●

●●

● ●
●●

● ●●


●● ●
●●


●●
●●


●●



●●


●●

●●
●● ●
●●
● ●

●●

● ●


●●


●●

●●



●●



●●

●● ●

●● ●●

●● ●
●●



●●

●●



●●

●●



●●

● ●


●● ●

●●
● ●
●●

●●

●●



●●

●●
● ●

● ●●


● ●


●●

●●


●●


●●


●●
●● ●
●● ●

● ●




●●



●●



●●

●●
●● ●
●● ●


●● ●●




●●

●●


●●




●●● ●

●● ●

●●
● ●●





●●



●●



●●
● ●
●● ●
●●
● ●●






●●




●●


●●

●● ●
●● ●
●●

● ●
●●


●●


●●

●●


●●
● ●●
● ●●

● ●
●●

●●


●●



●●

●● ●●
● ●●

● ●
●●


●●



●●



●●

● ●

● ●●

● ●
●●
●●
●●




●●



●●


●● ●
● ●


● ●
●●

●●

●●

●●


●● ●
●● ●


● ●
●●

●●


●●

●●

● ●
● ●


● ●
●●


●●

●●




●●

●●
● ●

● ●


● ●●

●●
●●




●●


●●
● ●
● ●

● ●
●●


●●
●●
● ● ● ●
|α2|

●●

●●
●●
●● ●● ●
●● ●●
Taylor fit (5 ) ●


































●●






● ●

●●

●●
● ●●








y


●●



●●



●●


● ●
● ●
●●
● ●




●●
●●
●●
● ● ●
● ●
0.879

0.879

●●

●●


●●


●● ● ●

● ●●

inflection ●






















































●● ●●

●●


●●

●● ●












●●
●●

●●


●● ●

● ●
●●



●●


●●


●●

● ●


● ●
●●


●●




●●



●●

● ●

● ●●



●●


●●



●●


● ●●
● ●●




●●


●●



●●● ●●
● ●


●●



●●




●●

●● ●
●●
● ●



●●



●●




●●
● ●
●● ●

●●

●●
●●



●●

●● ●

● ●●
●●


●●



●●



●●
●● ●

● ●●

●●


●●



●●


●●

● ●
● ●


●●

●●


●●

●●●
● ●
●●
● ●

● ●

●●

●●



●●




●●

●● ●
●● ●





●●


●●
● ●●


●●

●●




●●
● ●
●● ●
●●



●●



●●




●●



●●
● ●●

●●





●●

●●



●●
●● ●

● ●
●●

●●




●●


●●




●●
● ●
●●

●●



●●



●●

●●

● ●
● ●




●●

●●



●●




●●
●● ●

●●


●●

●●





●●


●●


● ●●
● ●


●●


●●


●●



●●


●●
●● ●
●●●



●●


●●


●●


●●
● ●
● ●


−1.599

−1.599




●●



●●



●●




●●


●●

●● ●●




●●


●●


●● ●
●●● ●

● ●
●●
●●
●●


●●



●●

●●



●●


●●

●●
● ●

●●

●●


●●

●●


●●


●●
●● ●

● ●●
●●
●●



●●

●●

●●


●●


●●
●●● ●
●●


●●




●●



●●

●●


●●


●●


●● ●●
● ●



●●



●●


●●


●●


●●


●●

●●

●●

●●

●●
●●
● ●●●●

●●




●●


●●

●●

●●



●●


●●


●●

●●
● ●●
● ●

●●

●●
●●



●●


●●



●●


●●



●●


●●


●●


●●



●●

●●
●●

●●

●●
●●

●●

●●

●●
●●
●●

●●


●●



●●




●●

●●


●●




●●



●●

●●



●●


●●

●●● ●
●● ●
●●
●●●
●●

●●

●●



●●


●●


●●

●●



●●



●●

●●


●●

●●



●●




●●



●●



●●


●●


●●


●●



●●



●●


●●
● ●

●●
●●

●●●●
●●●●●
● ●

●●
●●
●●● ●

1.002

1.801

2.600

3.400

4.199

4.999

1.002

3.431

4.999

x ρ

Figure 15: Find Root, Extreme and Inflection Point

14
The demo has been created by using knitr.

Did you find package useful? If yes, then inform dchristop@econ.uoa.gr or dem.christop@gmail.com.

15

View publication stats

You might also like