In MATLAB, $\pi$ value is given as 355/113. why?

683 Views Asked by At

$\pi$ is an irrational number. MATLAB shows it equal to 355/113 in fractional format. Is there no better fractional representation than 355/113 within the limits of the finite precision the computers use? How is the value arrived at?

2

There are 2 best solutions below

0
On

Matlab presumably showcases this close approximation somewhere. But it never ever trades that value for the true $\pi$.

To get to it, truncate $\pi$ to the nearest integer, take the fractional part and invert it. Repeat. The integers that you see are

$$3,7,15,1\cdots$$

So reverting the process, approximations of $\pi$ are

$$3,3+\frac17=\frac{22}7,3+\frac1{7+\frac1{15}}=\frac{333}{106},3+\frac1{7+\frac1{15+\frac11}}=\frac{355}{113},\cdots$$

Next are $\dfrac{103993}{33102}$, $\dfrac{104348}{33215}$ and you can continue.

2
On

The irreducible fraction $\frac{355}{113}$ of MATLAB gives certainly a good approximation, as @almagest comment. One could argue that the irreducible $\frac{208341}{66317}$ ($\frac{22}{17}+\frac{37}{47}+\frac{88}{83}$ indeed) is another rational approximation with an accuracy of nine decimal digits of exactness. However it is true that $\frac{355}{113}$ is easier to manipulate that $\frac{208341}{66317}$ which could be the MATLAB's purpose.