LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pi Approximation

I just saw a funny meme about a fraction that approximated PI to 2600 digits. That got me thinking of trying to find some, and this was my result!

Yamaeda_0-1780070480405.png

22/7 (the real PI day) is surprisingly good at such a simple fraction. 355/113 is a really good approximation and you need to get to 99733/31746 to get the best 5 digit one. With the last one it's correct to 10 digits!

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 1 of 10
(213 Views)

What we really need is a TAU day...

More PI for everyone!

0 Kudos
Message 2 of 10
(202 Views)

Cool!

 

Hey, this is 2026, so why not use a map instead of variant attributes?

On a side note, you could gain about 10-20% by just replacing the format into decimal string with a typecast. 😄

One flaw is that the third and fourth item have the same ratio

0 Kudos
Message 3 of 10
(171 Views)

Here's a quick draft that is about 50x faster. but leaves out digit groups that show no improvement. Probably has some bugs. 😄

 

altenbach_1-1780082252796.png

 

0 Kudos
Message 4 of 10
(138 Views)

@altenbach wrote:

Here's a quick draft that is about 50x faster. but leaves out digit groups that show no improvement. Probably has some bugs. 😄

 

altenbach_1-1780082252796.png

 


IMHO, when slicing up pi it is important to determine if there really are any bugs.  Just guessing that they exist and serving them up anyway is making my laugh my a** off!

 

EDIT: I was just informed that my reaction is irrational.   


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 10
(114 Views)

@JÞB wrote:
EDIT: I was just informed that my reaction is irrational.   

You are a COMPEX individual. 😄

 

My main concern were actually inherited from the original code. For example I did not understand where the 3183000 constant comes from. I initially made one with a while loop that terminated after checking all numbers up to a certain number of digits. This was slower, but still 10x faster than the original.

0 Kudos
Message 6 of 10
(92 Views)

@altenbach wrote:

@JÞB wrote:
EDIT: I was just informed that my reaction is irrational.   

You are a COMPEX individual. 😄

 


Not really 😕  Whenever I see numbers that are imaginary I tend to grab an oar and rho in any direction. (Which brings the thread back 2pi)

 

<rimshot>


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 10
(81 Views)

Keeping it real. 😄

0 Kudos
Message 8 of 10
(64 Views)

Paradoxically, using complex realm can simplify the math.  In AC circuit analysis, if you stay in the domain of real numbers, you need trigonometry; however if you venture into the domain of complex numbers, you only need linear algebra.

0 Kudos
Message 9 of 10
(39 Views)

@paul_a_cardinale wrote:

Paradoxically, using complex realm can simplify the math.  In AC circuit analysis, if you stay in the domain of real numbers, you need trigonometry; however if you venture into the domain of complex numbers, you only need linear algebra.


If you stay in Cartesian coordinates.   The linear algeba rolls up to simple vector addition when using Polar coordinates. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 10
(29 Views)