Hi. This is my first post so please let me know if I violate any kind of rules. Thank you in advance.
I intend to approximate pi by summing a specified number of terms (k). The output I got was nowhere near what I wanted. Could someone help me please?
Here is the equation I'm using:
And there is the code:
k = input('Number of terms: ');pi2 = sum(factorial([1:k]*4).*(1103+26390*[1:k]));pi2 = pi2/((factorial([1:k])^4)*396^(4*[1:k]));pi2 = (pi2*(2*sqrt(2)/9801))^(-1);fprintf('Method: %.20f\n', pi2);
Best Answer