The tan +10000 between 0 and p

            The codes for producing these plots are in atanm.zip.  The bli in this uses diff**2 rather than diff**8 to find the function.

Figure 1 tan(x)+10000 for 0<x<p

Figure 2  log(tan(x)+10000) for 1.57<x<1.58 

            The solution to tan(x) + 1000 is between 1.57 and 1.58.  An (x1,f1) below p/2 and (x2,f2) above p/2 has one value >0 and one less than 0, but if these are too close together, there is no solution between them.  That is on the final step fun(x1) ॠand fun(x2)à-¥

Code modification

            This leads a slight modification of the code which calls newait.  The final results are checked and then an upper and a lower solution in x is tried.

H:\fbnewait>fbrack

 ENTER A 1 TO EVALUATE TAN(X) OR 2 TO FIND ATAN(X)

2

 ENTER X

1.5

       1.5707963267948970  1.6331778728383850D+016

       1.5836730687844610     -76.1551032891675800

Y ßsucces Brack found (x1,f1),(x2,f2) such that f1´f2 < 0

.

.

.

TEST =   9.895D-015 ß distance between final x1, x2

 NCALL =           17

 AFTER NEWAIT X1,F1=  1.5707963267948970  1.63317787D+016

 AFTER NEWAIT X2,F2=  1.5707963267949120 -6.45915885D+013

Current method looks first from beg to x1

 beg, x1t        0.0000000000000000       0.0000000000000000

 SUCESS=N ß no x1, x2 was found such that f1´f2 < 0

 X1, F1        0.7853981633974483  2.500000000000

 X2, F2        1.5707963267948960  1.978945885716845D+015

 NCALL =           17 ßunchanged from previous attempt – no solution found in the lower region.

SUCESS=Y ß an f1,f2 such that f1´f2<0 is found in the upper region.

.

.

.

TEST =   2.0571124230620860D-016

 NCALL =           11

 AFTER NRAF3 X1,F1=   2.1587989303424640  7.29668062D-016

 AFTER NRAF3 X2,F2=   2.1587989303424640 -7.13621869D-016

 FUN1 HAS A ZERO AT        2.1587989303424640

 ENTER A 1 TO STOP

Choosing the region

After the first calls to newait

AFTER NEWAIT X1,F1=  1.5707963267948970  1.63317787D+016

AFTER NEWAIT X2,F2=  1.5707963267949120 -6.45915885D+013

 

A single call at the end of each region may tell the best region to do next.  This is important because the bli portion of brack can make many calls in the wrong region.

C:\temp\fbnewait>fbrack

 ENTER A 1 TO EVALUATE TAN(X) OR 2 TO FIND ATAN(X)

2

 ENTER X

1.5

       1.5707963267948970  1.6331778728383850D+016

       1.5836730687844610     -76.1551032891675800

Y

TEST =        0.0081975885542328 ß distance between x1 and x2 as returned by brack.

TEST =        0.0040987942771164

TEST =        0.0020493971385583

AITKINS NM

NM = 4 ß Aitkins followed by a halving of the interval

TEST =   2.5617464231978420D-004

TEST =   1.2808732115996280D-004

TEST =   6.4043660579981390D-005

AITKINS NM

NM = 4

TEST =   1.2658607632224800D-012

TEST =   6.3300106060416120D-013

TEST =   3.1650053030208060D-013

AITKINS NM

NM = 4

TEST =   3.9580236035990430D-014

TEST =   1.9790118017995220D-014

TEST =   9.8950590089976080D-015

 NCALL =           17 ß no change from earlier version

 AFTER NEWAIT X1,F1= 1.5707963267948970  1.633177872D+016

 AFTER NEWAIT X2,F2= 1.5707963267949120 -6.459158856D+013

UPPER END VAlUE        1.5000000000000000

 TESTING UPPER END

TEST =        0.9999999999999802

TEST =        0.9999999999999570

TEST =        0.9999999999999338

AITKINS NM

NM = 4

TEST =        0.1999999999999857

TEST =        0.1292893218813501

TEST =        0.1085045433938486

TEST =        0.1022227086420181

AITKINS NM

NM = 4

TEST =        0.0473788315949844

TEST =        0.0473762472380985

TEST =        0.0473758604808611

TEST =        0.0473758026013434

AITKINS NM ß NO NM=4 implies a positive function value

TEST =   3.2214360030917910D-009 ß Aitkin’s found the answer

TEST =   1.7659787676619360D-009

TEST =   2.0571124230620860D-016

 NCALL =           18

 AFTER NRAF2 X1,F1=2.1587989303424640 -7.13621869929D-016

 AFTER NRAF2 X2,F2=2.1587989303424640  7.29668062082D-016

 AFTER UPPER END TEST

1

 FUN1 HAS A ZERO AT        2.1587989303424640

 ENTER A 1 TO STOP

1

There are limits

C:\temp\fbnewait>fbrack

 ENTER A 1 TO EVALUATE TAN(X) OR 2 TO FIND ATAN(X)

2

 ENTER X

13777798537 ß 1.38´1010

 ENTERING BLI SECTION

 SUCCESS IN BLI PART IADD=           90

       1.5707963268908360  3.3545299575547700D+009

       1.5707963268428660 -7.0687519265768670D+009

Y

TEST =   3.0538413828607510D-011

TEST =   2.0710217147213690D-011

TEST =   1.7377561273085070D-011

AITKINS NP

TEST =   8.1237020880871130D-012

TEST =   7.6387028386791380D-012

TEST =   7.5594010086243800D-012

TEST =   7.5465374319131810D-012

AITKINS NP ß a sign change

TEST =   3.7721378520556620D-012

TEST =   3.7717137780981520D-012

TEST =   1.8858568890455190D-012

TEST =   9.4285776552895220D-013

TEST =   4.7142888276425390D-013

AITKINS NM

NM = 4

TEST =   5.8946280093736960D-014

TEST =   2.9402461053949460D-014

TEST =   1.4701230526974520D-014

AITKINS NM

NM = 4

TEST =   1.8376538158717910D-015

 NCALL =           21

 AFTER NEWAIT X1,F1=       1.5707963268674770    2117.9148396085950000

 AFTER NEWAIT X2,F2=       1.5707963268674740 -545856.6203782093000000

 UPPER END VAlUE   1.3777798537000000D+010

 AFTER UPPER END TEST

1

 ENTERING BLI SECTION

 SUCESS=N ß evaluated 256 function values to find no zero crossing below p/2

 

 F1*F2<0 BELOW I =           20

 SUCESS=Y ß on 20’th evaluation (before bli) found a zero crossing above p/2

TEST =        0.0980097587161128

TEST =   2.0838130622754350D-006

TEST =   4.4305550784697170D-011

AITKINS NP

NP = 4

TEST =   5.6543194334516570D-016

 NCALL =            5

 AFTER NRAF3 X1,F1=       1.5707963268674770    2117.9148396085950000

 AFTER NRAF3 X2,F2=       1.5707963268674760 -166484.9920339035000000

 FUN1 HAS A ZERO AT        1.5707963268674770

 ENTER A 1 TO STOP

1