It Begs The Question
Hey…I'm just saying… And while we're at it, why are you defending them?

Math Mystery Followup December 10, 2017

Numeric Precision and Order of Calculations

As They Apply To

Gerry’s Math Mystery Conjecture

Also read prior article  A Math Mystery   as well as   the next 2 articles

    Math Mystery Wrap Up

Epilogue to the Composites Chronicle

So, this will be the most engrossing blog post ever!   Hello!? … Hello!?… Is anybody out there!?

Actually,  he meant to say…

You’re gonna need a bigger computer.

This article is a historical record for myself but for some geeky computer types with an interest in math, or vice versa, you may find it of interest. This article has to do with:

1 – The differences in data types and how that affects calculations in our programs; especially programs that calculate things like a numeric series (like the harmonic series… e.g.)

2 – How the Order of calculation also makes a difference in the result. For example, in the above Harmonic Series, does it matter whether we start at the “left”

(1/1 then 1 /2 then 1/3 then… 1/n) or whether we start at the “right” and move back to the beginning of the series

(e.g. 1/n then 1/(n-1) then… 1/3 then 1/ 2 then 1/1).

The data types aspect is pretty obvious and is part of Programming 101.

In the prior article, “An Actual Math Mystery,” I used the C# program named SumOfReciprocals.exe to compute a few things over differing ranges. The purpose of the calculations was/is to help confirm, or to dispel the conjecture that:

ln(Cp) + Sp = Sn

Again, read An Actual Math Mystery

The SumOfReciprocals program mainly computes the following two series (plus a few other things). The user specifies the range of values on the screen.   Anyway, it computes the following:

“Vanilla Harmonic Series”

Harmonic Series of Primes

The following is an example test run:

 

 

The original program used C# doubles as the numeric data type (like so)

double dSumOfVanillaSeries;

double dSumOfPrimeSeries;

With doubles we get 15-16 significant digits. But could we do better?

Also, the computation of the two series was performed “left to right.” That is, smallest denominator to highest denominator… 1/1 + 1/ 2 + 1/3 …

As it turns out, the order of evaluation can make a difference. Look here

https://tomroelandts.com/articles/the-harmonic-series

So what would the difference/improvement be if we changed the order of evaluation (if any)?

After thinking about these issues for a while, I improved the SumOfReciprocals program by doing the following:

..1..   Variables were changed from double to decimal. This is a big improvement because the decimal data type provides 28-29 significant digits vs 15-16 for double.

..2..   The order of evaluation was changed to be a user choice.  Terms can now be evaluated left–>Right or Right–>Left  (user choice via a checkbox).

So… did the improvements to the program make a significant difference?   As it turns out,  for what I am investigating the improvements in “accuracy” (precision) don’t matter. What I’m after is whether it’s true that

Ln(pi(n)) + Sp = Sn

which means I use the SumOfReciprocals computations to see whether it looks like

(Sn / ( Ln(pi(n)) + Sp)) ~ 1        as n –> infinity

All that said, I can only run the SumOfReciprocals up to n = 1 Billion which takes about 35 minutes. So, to get results for 1 Trillion would require about 583 hours! I don’t think I’ll be doing that any time soon (although I’d like to).

In any event, and for what it’s worth,   the following show a comparison of a few results before and after the program improvements to SumOfReciprocals.exe.

Computing the RATIO (what I’m really interested in)

For n = 1 to 1 Billion

Before improvements using doubles and left–> right computation

RATIO = 1.01251978630066

After improvements using decimals and right–>left computation

RATIO = 1.0125194916706126049689541998

Color  shows where the differences begin. Even after improving by going from double to decimal data types and using right–>left processing, for n=1 Billion, the difference in the RATIO is negligible.

So just for grins, let’s see what differences there are with the order of processing the terms… The color coding will help us spot the differences.

n = 1.. 1 Billion

Starting Low and working to higher denominator (left → right)

Harmonic Series Sum = 21.300481502347944016685003449

Harmonic Series of Primes Sum = 3.2927653071574778714154682732

RATIO = 1.0125194916706126049689541998

Starting with higher denominator and working lower (right → left)

Harmonic Series Sum = 21.300481502347944016685100637

Harmonic Series of Primes Sum = 3.2927762759508852619827244781

RATIO = 1.0125189646875907288746445938

The above shows the computation differences for n = 1 .. 1 billion  depending on whether we process terms left to right, or,  right to left.

So there it stands. Experimentally it still looks like the conjecture is true but again, we’re only computing the two series up to n = 1 billion.

So, was this the most engrossing blog post ever!?

Hello!? … Hello!?… Is anybody out there!?

Categories Uncategorized

Leave a Reply

Your email address will not be published. Required fields are marked *