Skip to content

A small python script to calculate pi from Pascal's triangle

License

Notifications You must be signed in to change notification settings

falconite400/piFromPascal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Pi From Pascal's Triangle

This program (made with python 3) derives the number pi (3.14159... etc.) from Pascal's triangle.

alt text Each number in the triangle is calculated by adding together the two numbers above it.

Pi is derived from Pascal's triangle by taking the reciprocal of the third number of each row (excluding the first two rows), changing the sign of each fraction by alternating between two positive and two negative signs, starting with positive (+ + - - + + - - etc.), adding the fractions together, and them adding two to the sum.

For example, the first few reciprocals would be: alt text

Applying the + + - - part, we have alt text

Adding these together yeilds approximately 1.14207181707.

Adding 2 to this yeilds 3.14207181707, which is equal to pi to 2 decimal places.

The more numbers are used, the more accurate the result is. For example, when 10,000 numbers are used in the program, the result is 3.141592633593785, which is more accurate than the previous example.

About

A small python script to calculate pi from Pascal's triangle

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages