Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation
Components
Controls pictures
Deprecated components
Developer Documentation
Development Environment Documentation
Documents
About The Best Formula In The World
Architecture details
Benchmarks
Books
By Reference Argument Passing
Compatibility between versions
Creating And Using Libraries
Database Datatype Mapping
Database Request Quoting
Date & time management
Dates and calendars
DBus and Gambas
Differences Between Shell And Exec
Differences From Visual Basic
Distributions & Operating Systems
Drag & Drop
DrawingArea Internal Behaviour
External functions datatype mapping
Frequently Asked Questions
Gambas Farm Server Protocol
Gambas Mailing List Netiquette
Gambas Markdown Syntax
Gambas Naming Conventions
Gambas Object Model
Gambas Scripting
Gambas Server Pages
Gambas Unit Testing
Gambas Wiki Markup Syntax
Getting Started With Gambas
Hall Of Fame
Image Management In Gambas
Including Help Comments in Source Code
Interpreter limits
Introduction
Just In Time Compiler
Just In Time Compiler (old version)
License
Localisation and Internationalization
Mailing Lists & Forums
Naming Conventions
Network Programming
ODBC Component Documentation
PCRE Pattern Syntax
Porting from Gambas 2 to Gambas 3
Previous News
Project Directory Structure
Release Notes
Reporting a problem, a bug or a crash
Rich Text Syntax
Screenshots
Text highlighting definition file syntax
The Program has stopped unexpectedly by raising signal #11
Variable Naming Convention
WebPage Syntax
Web site home page
What Is Gambas?
Window & Form Management
Window Activation & Deactivation
Window Life Cycle
XML APIs
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Last Changes
Lexicon
README
Search the wiki
To Do
Topics
Tutorials
Wiki License
Wiki Manual

About The Best Formula In The World

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 e = -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 e = -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, e = -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. :-)