07-22-2018, 12:33 AM
.
Hi, Albert:
You're welcome. Thanks to you for your fresh and effective insight, your contribution to this subject has been truly outstanding and I for one appreciate it. Also, I'm glad if my numeric quadrature results were useful for you to check your remarkably accurate approximations.
Sure it does. These are the results my quadrature program outputs for the various ranges you mention:
I(20000, 0..Pi/40000)
0 0.000000767448975625012059728677812789736739179600994
1 0.000000767448983276014084555342766291500235218569303
2 0.000000767448983276034720208510846724248989670327563
3 0.000000767448983276034720208518559793576182713599610
4 0.000000767448983276034720208518559793576182713598529 (all 51 decimals digits shown are correct)
I(20000, 0..Pi/400000)
0 0.00000076744898327603472020851855979357618264054999631
35064117112150402698116508077139817678384714549561511
1 0.00000076744898327603472020851855979357618264054999631
35038511379081941548835069200608164307257330429915401
2 0.00000076744898327603472020851855979357618264054999631
35038511379081941548835069200608164289806491475047963 (all 106 digits shown are correct)
However, I concur with you that the fact that these results are accurate to 51 and 106 decimal digits, respectively, for both shrunk ranges does not necessarily mean that after multiplying them by the correct factor the resulting approximate values for the full-range (0..2*Pi) integral will be accurate to that many digits, in fact it's quite conceivable that they are not because both results above match only up to 42 digits, namely:
0.000000767448983276034720208518559793576182
Last but not least, using your remarkable shrinking technique, the value on the full integral for N=20,000 indeed can be computed using an HP calc using just its native 12-digit precision (!!), as these 3 lines of code I wrote for the HP-71B convincingly demonstrates:
1 DESTROY ALL @ SFLAG -1 @ DIM P,I @ DISP 4*INTEGRAL(0,PI/40000,1E-8,FNF(IVAR))
2 DEF FNF(X) @ P=1 @ FOR I=1 TO 20000 @ P=P*COS(I*X) @ IF NOT P THEN END
3 NEXT I @ FNF=P
>RUN
3.06979593356E-6 (75 min. in Emu71) wich is accurate to 10 digits.
Note: That simplest of tricks in the function's definition ("IF NOT P THEN END") halves the computing time.
Regards.
V.
.
Hi, Albert:
(07-21-2018 04:00 PM)Albert Chan Wrote: [ -> ]From Valentin Albillo last post, my estimate match correct values, to 15 digits. Comparing values in binary form, accuracy is even better, mine is just 6 ULP over !
Thanks Valentin. I am amazed at how your integration function work.
You're welcome. Thanks to you for your fresh and effective insight, your contribution to this subject has been truly outstanding and I for one appreciate it. Also, I'm glad if my numeric quadrature results were useful for you to check your remarkably accurate approximations.
Quote:You mentioned the problems of it computing I(20000).
Shrinking the integral range 800,000 times may help: (0 to Pi/400000) instead of (0, 2 Pi)
Sure it does. These are the results my quadrature program outputs for the various ranges you mention:
I(20000, 0..Pi/40000)
0 0.000000767448975625012059728677812789736739179600994
1 0.000000767448983276014084555342766291500235218569303
2 0.000000767448983276034720208510846724248989670327563
3 0.000000767448983276034720208518559793576182713599610
4 0.000000767448983276034720208518559793576182713598529 (all 51 decimals digits shown are correct)
I(20000, 0..Pi/400000)
0 0.00000076744898327603472020851855979357618264054999631
35064117112150402698116508077139817678384714549561511
1 0.00000076744898327603472020851855979357618264054999631
35038511379081941548835069200608164307257330429915401
2 0.00000076744898327603472020851855979357618264054999631
35038511379081941548835069200608164289806491475047963 (all 106 digits shown are correct)
However, I concur with you that the fact that these results are accurate to 51 and 106 decimal digits, respectively, for both shrunk ranges does not necessarily mean that after multiplying them by the correct factor the resulting approximate values for the full-range (0..2*Pi) integral will be accurate to that many digits, in fact it's quite conceivable that they are not because both results above match only up to 42 digits, namely:
0.000000767448983276034720208518559793576182
Last but not least, using your remarkable shrinking technique, the value on the full integral for N=20,000 indeed can be computed using an HP calc using just its native 12-digit precision (!!), as these 3 lines of code I wrote for the HP-71B convincingly demonstrates:
1 DESTROY ALL @ SFLAG -1 @ DIM P,I @ DISP 4*INTEGRAL(0,PI/40000,1E-8,FNF(IVAR))
2 DEF FNF(X) @ P=1 @ FOR I=1 TO 20000 @ P=P*COS(I*X) @ IF NOT P THEN END
3 NEXT I @ FNF=P
>RUN
3.06979593356E-6 (75 min. in Emu71) wich is accurate to 10 digits.
Note: That simplest of tricks in the function's definition ("IF NOT P THEN END") halves the computing time.
Regards.
V.
.