Gambas Documentation - /doc/formula

/doc/formula

# About My Preferred Formula

Many people find the following formula shocking:

They think that I didn't learn mathematic at school, or that I am becoming mad.

Well, honestly, I am not sure that they are wrong on the last point.

But there is another possibility:

Maybe your teachers didn't tell you all the truth?

After all, didn't they tell you that an atom is a kernel made of big balls named neutrons and protons, with little balls orbiting around named electrons?

Here is another shocking formula:

1 + 2 + 3 + 4 + ... = -1/12

Hey! Don't leave! Come back! I will give you the explanation...

I will even give you two explanations.

No, better, I will give you THREE explanations!

## The Short Explanation

Your confusion comes from the fact that you supposed that this formula is calculated in ℝ, the set of real numbers.

But were you told about the p-adic numbers?

In a few words, the p-adic numbers are an extension of ℚ, the set of rational numbers, but not done in the same way that leads to ℝ.

The difference is in the way the absolute value is computed, and that implies that the right part of the formula is a convergent series in the p-adic numbers set when p = 2. And the limit of this series is...-1.

And as eiπ = -1, the formula is correct.

As for the left part of the formula, you may ask if it has sense with p-adic numbers?

To be honest, I am not sure, but if I understand the Wikipedia article above correctly, it seems that it is ok. If you can confirm that, please tell me!

## The Long Explanation

In this explanation, your confusion comes from the fact that in mathematics you often write an algorithm and the value of a function the same way when the value of the function is calculated with that algorithm most of the time.

I know, that is not very clear. I want to talk about analytic functions and their continuation.

In a few word, the right part of the formula is not just an infinite sum. It is actually the value of a function defined this way:

f(x) = ∑ xk, k:0→+∞

You will tell me, this function is defined only for x ∈ ]0,1[!

I will agree.

But if f has a specific form, i.e. if f is an analytic function, which is the case there, then we can define a function g that is the continuation of f. That function g takes the same value as f in the interval where f is defined, and takes other values on area where f is not defined. Moreover, this continuation is unique!

See the Wikipedia articles above for more details.

So, in our specific case, our infinite sum is actually the continuation of f(x), and that continuation takes the value -1 when x = 2!

And as eiπ = -1, the formula is correct.

As for the second shocking formula, this is the result of a continuation too. That formula was discovered by Riemann, and discovered again a few years later by Ramanujan.

## The Geek Explanation

A geek does not need to learn mathematics.

He has a computer.

Run this in Gambas:

    Dim S As Integer
    Dim P As Integer

    P = 1

    Do

      S += P
      Print S;;
      P += P

    Loop

    1 3 7 15 31 63 127 ... 1073741823 2147483647 -1 -1 -1 -1 -1 -1 ...

Easy... My simple program shows that it converges to the -1 value.

Writing programs is so easier than mathematics... :-)

## Conclusion

After these three explanations, I hope you will be convinced.

For information, eiπ = -1 was the preferred Formula of Richard Feynman. I just added my little series because I am a computer scientist and I like powers of two. :-)

Next time, maybe I will tell you the value of 0/0. :-)

Or I will explain that void and light do not exist, and that time is a pure illusion like temperature. :-p