Repetition control structures using factorial in Srinivasa Ramanujan equation

4 views (last 30 days)
A very powerful approximation for ππ was developed by a brilliant mathematician named Srinivasa Ramanujan. The approximation is the following: 1/π = (22/9801)* ∑*N k=0 ((4k)!*(1103+26390*k)*(k!)43964k))/((k!)^(4)*396^(4)*k)
! stand for factorial, k =0 is a lower bound of the summation
YOU CAN ALSO GOOGLE SEARCH SRINIVASA RAMANUJAN EQUATION IF YOU DON"T GET THE ONE I TYPED
  • Implement Ramanujan’s formula for N=5N=5 to approximate ππ using a for loop.
  • Using a while loop and Ramanujan’s formula, determine the value for NN such that ππ is approximated with an error less than 1e-6. (You may NOT use the MATLAB value of ππ to find $N.
Note: 0!=10!=1 by definition.

Answers (1)

Sabin
Sabin on 1 Feb 2023

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!