I decided to numerically calculated pi using MATLAb and running a for loop. When I make the steps too small I get absurd quantities for pi. Here see for yourself. When I make the interval higher then about 1e10 i get errors, but 1e6 works ok. Why would this be? Thanks(adsbygoogle = window.adsbygoogle || []).push({});

<code>

clc

clear all

interval = 1e11;

pi_calculated = 0;

for i = -1: 2/interval :1

pi_calculated = sqrt(1-i^2)*2/interval + pi_calculated;

end

format long

pi_calculated = 2*pi_calculated

<code>

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Strange Result Calculating pi.

Loading...

Similar Threads for Strange Result Calculating | Date |
---|---|

B How can I show the sum results in this? | Mar 12, 2018 |

Strange tangent for parametric | Jan 21, 2015 |

Strange indefinite integral | Dec 30, 2014 |

A strange derivative-integral discrepancy | Dec 4, 2014 |

It seems strange?+x+x .(x times)=x^2 then x=2x(differentiate wrt x)? | Jan 23, 2012 |

**Physics Forums - The Fusion of Science and Community**