Saturday , 23 November 2024

How to calculate Pi with Python

I am sure that many of you have wonder at least once in your live what is PI really? and how you can calculate it.

This is going to be a short post and i’ll try to keep it as simple as possible.

So first let’s begin explaining what pi actually is?

We can define Pi as a mathematical constant. It is defined as the ratio of a circle’s circumference to its diameter, but Pi it’s more than just that it’s turn out to be like i said before an mathematical constant and it appear in many different branches of math.

In this post i will teach you the one that i think is the easiest one.

we will begin knowing that π²/6 is equal to the sums of the inverse of all natural number power 2

this is the Basel problem prove by Euler in 1734. And its look kind of weird but trust me its really easy.

we can express it like this:

(1/1²)+(1/2²)+(1/3²)+(1/4²)+(1/5²)+(1/6²)+(1/7²)+(1/8²)+(1/9²)+…

thats and equal to somethis like 1.64493306684777…

So now we know that π²/6=1.64493306684777, so we can find out pi by clearing the equation and it’s end up like π²=(1.64493306684777)(6)

and that’s equal to 3.1415.

So now that we know how to calculate pi let’s code it.

So as you may notice it’s took the range from 1 to 1000000 that’s because it is and aproximation and we get closer to the actual real number of pi increasing the range of number to use.

I hope that you actually learned something in this post otherwise this is my first post and i will try to get better at it.

Note: 

Are you a content creator? If yes then we welcome bloggers & they can submit a guest post to our famous blog for free, just search in google, we are on top of search engine “ write for us + travel”, You will find “Lifeyet News”.

About Web Master

Check Also

Building Your Startup Future on entretech.org

Introduction Entrepreneurship is the heartbeat of innovation, and every startup dreams of making it big …

Leave a Reply

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