Browse Search Popular Register Upload Rules User list Login:
Search:
Single Ball Galton Board

Image:
screenshot of the scene

Author: Xray

Group: Default

Filesize: 253.84 kB

Date added: 2024-03-19

Rating: 5.6

Downloads: 5839

Views: 771

Comments: 20

Ratings: 2

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

See explanation in the scene...
Please log in to rate this scene
edit
Similar scenes
Title: Galton Board
Rating: 6.2
Filesize: 45.21 kB
Downloads: 729
Comments: 7
Ratings: 4
Date added: 2009/03/29 06:00:32
Made with: Phun
Rating: rated 6.2
download
Title: Galton board
Rating: 5
Filesize: 154.71 kB
Downloads: 536
Comments: 0
Ratings: 1
Date added: 2024/03/17 15:02:48
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Statistics - Galton board (bean machine)
Rating: 5
Filesize: 204.32 kB
Downloads: 1160
Comments: 0
Ratings: 1
Date added: 2011/05/04 11:26:29
Made with: Algodoo before v1.8.5
Rating: rated 5
download
Title: Ball Balance Game
Rating: 6.3
Filesize: 383.08 kB
Downloads: 1529
Comments: 5
Ratings: 4
Date added: 2014/01/25 07:55:09
Made with: Algodoo v2.1.0
Rating: rated 6.3
download
Title: The Bell Curve
Rating: 7.3571
Filesize: 46.18 kB
Downloads: 60982
Comments: 16
Ratings: 8
Date added: 2009/08/18 04:10:52
Made with: Phun
Rating: rated 7.4
download
Title: Scripted Bomb
Rating: 5.8889
Filesize: 22.84 kB
Downloads: 1341
Comments: 4
Ratings: 3
Date added: 2010/03/08 17:10:15
Made with: Phun
Rating: rated 5.9
download
Responses to this scene
show list
Title: Virtual Galton Board
Rating: 5
Filesize: 65.67 kB
Downloads: 386
Comments: 11
Ratings: 1
Date added: 2024/03/23 13:08:42
Made with: Algodoo v2.1.0
Rating: rated 5
download
It's funny what happens if you press play after it pauses hehe >:3
Yeah, it's home-grown Thyme script, so I did not bother to check my code for all possible exceptions. :blush:
The middle row gets...
Long after a while...
Too long...
Yes, that's known as "regression to the mean". You can run the scene a thousand times (or a million times if you don't die during the test), the middle bin will almost always receive most of the balls. The resulting shape of the stacks of balls form a Gaussian (bell-shape) curve, although technically the distribution is a binomial distribution because of the binary nature of each peg and how they are configured.
Awesome and simple demo of the concept! good stuff ^w^
Thank you.
Some questions:
1. How do you configure each peg for a binary probability?
2. What are the units of the average?
3. What are the units of the standard deviation?
4. How well does this scene's distribution match the binomial distribution?

Thoughts:
In order to have perfect 50% probability, a ball would need to be exactly over the center of the peg and have vel(0)=0.0 at some point in time. If that were true the ball would end up perfectly balanced over the peg, so there needs to be some randomness in the calculations for the scene to work.
s_noonan - Thanks for your concerns and ideas. No, the scene is not "perfect" at all. I just whipped something together for people to play around with. If I were making this for a government agency or the U.S. military, then of course it would be much more accurate and precise. Concerning your question about making sure each peg has binary probability, I did at first, but, as you mentioned, the balls would occasionally get stuck at the exact center of their X position. So, by allowing a tiny bit of "slop" in their positions, that was no longer a problem. The worst offender in that regard was the first peg at the top of the triangle because the balls are at their lowest velocity at that point and they typically fall straight down. The other pegs typically receive the balls after they were deflected by a higher peg at a 45 degree angle. That's why I gave that particular peg a pointed head. (LOL)

More: Concerning your question (#3) about units, the standard deviation value represents the same unit of measurement that any person playing this scene used for the heights of the balls in the bins. For example, if you measured the ball heights in centimeters, then the standard deviation is also in centimeters. It quantifies the average distance of the ball heights from the mean height, in whatever unit you originally measured them in. So, if your measurements were in inches, meters, or any other unit, the standard deviation would be expressed in that same unit.
Last edited at 2024/03/23 17:00:42 by Xray
Here's what I think the answers to the questions are:

Q1: How do you configure each peg for a binary probability?
A1: I don't think there is a way to do it perfectly, although, after looking at all the other Galton board scenes, I see some scenes do a fairly good job (yours included).

Q2: What are the units of the average?
A2: The units are average balls/bin from your code.

Q3: What are the units of the standard deviation?
A3: It looks like bin count. I don't understand the formula. Do you have a source?

Q4: How well does this scene's distribution match the binomial distribution?
A5: The Chi-square goodness-of-fit test is often used to determine whether observed data fits a specific distribution, such as a binomial distribution. A simpler approach would be to put the outline of the perfect binomial distribution curve in your scene. I do neither in my scene.
Q: I don't understand the formula. Do you have a source?

A: The following was copied from the Khan Academy website:

Here's how to calculate population standard deviation:
Step 1: Calculate the mean of the data—this is‍
in the formula.
Step 2: Subtract the mean from each data point. These differences are called deviations. Data points below the mean will have negative deviations, and data points above the mean will have positive deviations.
Step 3: Square each deviation to make it positive.
Step 4: Add the squared deviations together.
Step 5: Divide the sum by the number of data points in the population. The result is called the variance.
Step 6: Take the square root of the variance to get the standard deviation.
Thanks. The formula is what I would expect, but I'm not sure if it's being applied correctly. I would expect a value to be applied to each bin like [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5] and a ball that falls in that bin would be assigned the value of the bin. The mean would be the sum of all the ball values divided by the number of balls. The standard deviation would calculated using the steps you mentioned above. I would expect the calculation to include n deviations, where n is the number of balls. The standard deviation units would be in terms of ball values or bin width. Your standard deviation calculation has a deviation associated with each bin ball count instead of with each ball. The calculation might be correct, but I'm not understanding it. It could be that both methods are correct and I'm just not seeing the second method.
I only recently learned about the math behind the Galton Board and so I may not be applying it correctly, especially with my weird version of it that uses a single ball that keeps repeating until N balls have fallen into bins. It's different than a bunch of balls simultaneously falling and interacting with each other. If you are fairly certain that I did something wrong, please let me know what it was and I'll correct it. Thanks...

By the way, I watched a video about a guy who was toying with the idea of a 3D Galton Board! He realized that actually building one would probably be physically impossible but he thinks he figured out the math for it. I wouldn't even think about attempting such a thing in Algodoo! :lol:
Me:
I now see that the standard deviation calculation in this scene is incorrect since it does not take into account the relative position of the bin counts. The bin counts can be in any order and the calculation will yield the same result. Standard deviation is an indication of the "spread" of the data.

AI:
Ah, I’ve just realized something! The way we’re calculating the standard deviation here doesn’t quite hit the mark. You see, it’s not considering the relative positions of the bin counts. Funny thing is, we could jumble up the order of the bin counts and we’d still end up with the same result. But that’s not quite right, is it? After all, the standard deviation is supposed to give us a sense of how much our data is spreading out from the mean. Let’s see if we can fix this! 😊
AI is absolutely correct, I just didn't quite know how to put it into words that made sense. I would be happy if he (ummm, I mean "it") could fix it! Thanks for your help with this, s_noonan. :)
If you ask AI (MS Edge Copilot, for example): "Create a Python script that uses only the tkinter and random libraries to simulate a Galton board. Calculate the mean and standard deviation of the sample without using the statistics module." It will generate the logic and math necessary to run your scene. You would just need to translate the logic and math to thyme. The program that was created for me has only 33 source lines of code.
Great! I do have Copilot so I'll give that a try. Thanks again.
scene.my.calculate && _once ? {
  sim.running = false;
  scene.my.numOfBalls = scene.my.bin0count
    + scene.my.bin1count
    + scene.my.bin2count
    + scene.my.bin3count
    + scene.my.bin4count
    + scene.my.bin5count
    + scene.my.bin6count
    + scene.my.bin7count
    + scene.my.bin8count
    + scene.my.bin9count
    + scene.my.bin10count;
  scene.my.mean = (
    - 5.0 * scene.my.bin0count
    - 4.0 * scene.my.bin1count
    - 3.0 * scene.my.bin2count
    - 2.0 * scene.my.bin3count
    - 1.0 * scene.my.bin4count
    + 0.0 * scene.my.bin5count
    + 1.0 * scene.my.bin6count
    + 2.0 * scene.my.bin7count
    + 3.0 * scene.my.bin8count
    + 4.0 * scene.my.bin9count
    + 5.0 * scene.my.bin10count
  )/scene.my.numOfBalls;
  text = "Mean: \n" + scene.my.mean;
  _once = false;
  scene.my.calcStdDev = true  
}:{};  

scene.my.calcStdDev ? {
  scene.my.var = (
    scene.my.bin0count * (- 5 - scene.my.mean)^2
    + scene.my.bin1count * (- 4 - scene.my.mean)^2
    + scene.my.bin2count * (- 3 - scene.my.mean)^2
    + scene.my.bin3count * (- 2 - scene.my.mean)^2
    + scene.my.bin4count * (- 1 - scene.my.mean)^2
    + scene.my.bin5count * (0 - scene.my.mean)^2
    + scene.my.bin6count * (1 - scene.my.mean)^2
    + scene.my.bin7count * (2 - scene.my.mean)^2
    + scene.my.bin8count * (3 - scene.my.mean)^2
    + scene.my.bin9count * (4 - scene.my.mean)^2
    + scene.my.bin10count * (5 - scene.my.mean)^2)
    /(scene.my.numOfBalls - 1);
  scene.my.stdDev = scene.my.var ^ 0.50000000;
  text = "Standard Deviation: " + scene.my.stdDev;
  scene.my.calcStdDev = false  
}:{};
Last edited at 2024/04/03 10:14:20 by s_noonan
if u press play after the middle gets most then the middle goes "GAS GAS GAS":lol:
Those are lyrics from "Jumpin Jack Flash" by The Rolling Stones. :lol:
middle gets 95 while second is 55 and the worst is 6 :L