Today I'd like to teach you all about one of my all time favorite constants: π!
Most likely, all of you know that π is the ratio of a circle's circumference to its diameter, and probably only know only 3 to 5 decimal digits of it. However, π is an irrational number, meaning it has no end! Let us go through all of the different formulae of π I have programmed, and explain what they mean! Let's dive in. (These are numbered in the order that they print when the attached code is run)

1. The Monte Carlo Method

One way you can do this is by drawing a square, with a circle whose edges touch the 4 edges of that square within. Now imagine you were to draw many many dots randomly within the square-circle hybrid. If you take the number of points that fell within the circle, divide it by the total number of points, and multiply it by 4, you get (you guessed it) π!! More info can be found here:
https://ja.wikipedia.org/wiki/モンテカルロ法

1. The Chudnovsky Algorithm

This is one of the fastest methods out there, being used in the world record, to calculate 50 trillion digits of π! I already explained it in a previous post, but the formula (and more cool information!) is here:
https://ja.wikipedia.org/wiki/モンテカルロ法

1. The Basel Problem

This problem, posed by a man named Pietro Mengoli, asked for the exact sum of an infinite series, with proof. Mathematician Leonhard Euler answered this, with proof, finding it to equal exactly π^2/6. Further info and interesting facts here:
https://ja.wikipedia.org/wiki/バーゼル問題

1. The Wallis Product

Unlike the other formulae here, this one uses the Product Operator in its equation. If repeated over an infinite number of times, it will equal π/2. More information here:
https://ja.wikipedia.org/wiki/ウォリス積

1. The Leibniz Formula

Last but certainly not least, I have here probably one of the slowest π-convergent methods out there. In fact, to get π accurately to 10 decimal places takes about 5 billion iterations, according to the Wikipedia page! This formula alternates between adding and subtracting fractions with odd denominators (meaning this is an example of an alternating series), and converges on π/4. For extra information, go here:
https://ja.wikipedia.org/wiki/ライプニッツの公式

I plan to make more π approximation programs in the future, so stay tuned if these kinds of things interest you as much as they interest me!

Thank you. ^ ^

You are viewing a single comment. View All
AmazingMech2418 (661)

@Highwayman I'm pretty sure elliptic curve cryptography is just another method of asymmetric encryption which uses the same overall ideas as the Diffie-Hellman Key Exchange while not using the same methods of modular exponentiation. I've never really researched ECC before, but I know it is just another method of asymmetric encryption like RSA and Diffie-Hellman Key Exchange. What I mean by the overall ideas is using another person's public key and your private key to create the same secret as if you used the other person's private key and your public key.

@LizFoster , I would definitely recommend cryptography. It is a great way to delve into the application of mathematics and computer science. For example, with the Diffie-Hellman Key Exchange you use modular exponentiation which is pure mathematics and apply computer science to complete the algorithm and create the shared secret key from the Diffie-Hellman Key Exchange. Of course, however, there are less math-based cryptographic algorithms as well such as monoalphabetic substitution which really isn't even an exact science and just making educated guesses until you get the original plaintext from the ciphertext, but there are also many math-based ciphers and methods such as Diffie-Hellman, RSA, and even, although with much less complex math, Affine Ciphers including the Caesar Cipher which just has an "a value" of 1. The interesting thing about cryptography is that it combines linguistics, computer science, and mathematics into one field of research that can be applied to the real world easily with the encryption and decryption used on the Internet (usually RSA, but other ciphers are used occasionally).

If anyone has any questions about cryptography, feel free to ask me. I have been studying cryptography on the side for a while now, even to where I ended up getting first place in a cryptography competition earlier this year.