I was trying out an iterative solution to computing the value of π, being a sum of a simple formula. I made a straightforward implementation like so:
4×+/{(¯1*⍵+1)÷¯1+2×⍵}¨⍳1000000
The above _expression_ performs 1 million iterations, but is also allocates a 1 million element array to do so.
Is there a simple and natural way to perform this computation in an iterative manner using the power operator (⍣)?
Regards,
Elias