Discuss Scratch

AFNNetworkK12
Scratcher
1000+ posts

How to calculate pi?

I am trying to calculate pi with math operators, how can i connect all the math operators together in order to calculate the first 30 digits of pi, and also, if you know math, how do you calculate pi?
Currently i have no progress.
Flipped_
Scratcher
500+ posts

How to calculate pi?

Pi is the ratio of the circmuference of a circle over the diameter, or the amount of times the diameter fits into the circumference. Unfortunately I don't think Scratch can handle 30 digits of an irrational number, it will round the number to the 16th place.

Last edited by Flipped_ (March 18, 2019 19:38:52)

AFNNetworkK12
Scratcher
1000+ posts

How to calculate pi?

Flipped_ wrote:

Pi is the ratio of the circmuference of a circle over the diameter, or the amount of times the diameter fits into the circumference. Unfortunately I don't think Scratch can find 30 digits of an irrational number.
That doesn't help, try look at:
https://www.wikihow.com/Calculate-Pi#Using_Arcsine_Function.2FInverse_Sine_Function_sub
Then try to make it to scratch.
Flipped_
Scratcher
500+ posts

How to calculate pi?

I tried using operators to recreate the equation on Scratch, but it seems to always return 180. I even put the equation into a scientific calculator, and I still got 180 as the answer. Maybe the equation is wrong?
AFNNetworkK12
Scratcher
1000+ posts

How to calculate pi?

Flipped_ wrote:

I tried using operators to recreate the equation on Scratch, but it seems to always return 180. I even put the equation into a scientific calculator, and I still got 180 as the answer. Maybe the equation is wrong?
Search up how to calculate
Flipped_
Scratcher
500+ posts

How to calculate pi?

The best thing I could find that could be computed in Scratch was 355 divided by 155, which gives the value of pi to the 6th digit.
gor-dee
Scratcher
1000+ posts

How to calculate pi?

the formula is correct but the picture of the calculator is wrong…it should be on radians (RAD) not degrees (DEG)
Scratch uses degrees so you might be better using a different formula. Try Pi = x * sin(180/x) where x is any number but the bigger the better

Last edited by gor-dee (March 18, 2019 22:59:43)

Catalystix
Scratcher
100+ posts

How to calculate pi?

Did a little test project based on an example equation i found: https://scratch.mit.edu/projects/294999544/

it is based on an equation from: http://mathworld.wolfram.com/PiApproximations.html with many different ways to get pi but here is the one i used below that is supposed to be to 30 digits and doesnt need to be in radians.

pi ≈ (ln((640320)^3)+744)/sqrt(163) (sorry if my parentheses are off)

I found that putting it in a variable only gave me 7 digits but putting it in a list gave me 16 digits of pi. the only issue that i ran into was exponent but i added a logarithm to fix that. so overall it looks like
lnof10^of3*logof640320+744/Sqrtof163

hope this helps.

Last edited by Catalystix (March 18, 2019 23:44:10)

Scratch-Minion
Scratcher
1000+ posts

How to calculate pi?

Here are two of my projects that have “easy” math to calculate Pi.

The projects do not calculate Pi to 30 places as that is beyond the Scratch limit for storing significant digits.
(The Scratch limit is about 15 digits as in most computer languages).

An Approximation of Pi: https://scratch.mit.edu/projects/149771540/

Pi by Polygon Perimeters: https://scratch.mit.edu/projects/150047760/

To understand the math in this second project, read the comment inside the project and make a drawing following the instructions there.


* If you want to see how mathematicians might calculate Pi on a PC, see
Super Pi Calc by @DadOfMrLog https://scratch.mit.edu/projects/47680290/
It calculates 1000 digits of Pi in 1.3 seconds on my PC.
CrystalGames98
Scratcher
1 post

How to calculate pi?

I made an approximate one using the infinite (1/1)+(1/3)-(1/5)+(1/7)… formula. And it's incredibly accurate.
chrdagos
Scratcher
500+ posts

How to calculate pi?

CrystalGames98 wrote:

I made an approximate one using the infinite (1/1)+(1/3)-(1/5)+(1/7)… formula. And it's incredibly accurate.
True. But it's also VERY slow. even after adding and subtracting 500000 times, you only have 5 digits of pi correctly calculated. So try other methods of calculating pi.

Last edited by chrdagos (Nov. 22, 2019 21:09:10)

Wainggan
Scratcher
500+ posts

How to calculate pi?

chrdagos wrote:

CrystalGames98 wrote:

I made an approximate one using the infinite (1/1)+(1/3)-(1/5)+(1/7)… formula. And it's incredibly accurate.
True. But it's also VERY slow. even after adding and subtracting 500000 times, you only have 5 digits of pi correctly calculated. So try other methods of calculating pi.
Please don't necropost.
Shuyakado
Scratcher
9 posts

How to calculate pi?

1/1+1/3-1/5…
1/v+1/v-1/v…-pi!!

Last edited by Shuyakado (March 9, 2020 03:49:26)

s182588m
Scratcher
7 posts

How to calculate pi?

idk how to calculate pi but here is more than 30 digits memorized:

3.14159265358979323846264338327950288419
usavictor
Scratcher
48 posts

How to calculate pi?

s182588m wrote:

idk how to calculate pi but here is more than 30 digits memorized:

3.14159265358979323846264338327950288419
hey, uh, there's too many necroposts here, please stop posting on old topics, just look at the date of the last post and consider if you should post, and if it is old, just make a new topic. calculating pi is pretty complicated though, but there are some pi calculators on scratch so it is definitely possible to calculate it. you may need to look it up though, and some answers are already at the top of the thread.

Last edited by usavictor (May 12, 2020 02:31:38)

Powered by DjangoBB