basel problem in python – Lifeyet News https://lifeyet.com Lifeyet News Sat, 05 Oct 2024 07:35:58 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.3 https://lifeyet.com/wp-content/uploads/2024/09/cropped-images-32x32.png basel problem in python – Lifeyet News https://lifeyet.com 32 32 How to calculate Pi with Python https://lifeyet.com/how-to-calculate-pi-with-python/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-calculate-pi-with-python https://lifeyet.com/how-to-calculate-pi-with-python/#respond Thu, 23 Nov 2023 16:32:21 +0000 https://www.lifeyet.com/?p=32662 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 […]

The post How to calculate Pi with Python appeared first on Lifeyet News.

]]>
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”.

The post How to calculate Pi with Python appeared first on Lifeyet News.

]]>
https://lifeyet.com/how-to-calculate-pi-with-python/feed/ 0