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 | Science Articles, Homework Help, Discussion**

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.

**Physics Forums | Science Articles, Homework Help, Discussion**