Marble Bag Simulation

Marble Bag Simulation
Loading the math board and drawing, please wait…
2013-06-07 12:33
This example demonstrates the process of randomly selecting marbles (with replacement) from a bag containing different colored marbles, and displays the probability distribution of the selection results through bar charts. Key math concepts include probability & statistics, percentages, ratios, and function graphs. It utilizes GeoGebra commands/objects like If, Circle, Sequence, CountIf, Vector, Element, Polygon, Midpoint, Line. Suitable for high school students learning probability statistics and data analysis.

GeoGebra Commands & Parameters

  1. If(N_{colors} < -1, R, 0) → R2
  2. If(N_{colors} < -1 * 2, G, 0) → G2
  3. If(N_{colors} < -1 * 3, P, 0) → P2
  4. If(N_{colors} < 0, B, 0) → B2
  5. If(rand_{bag-blue} > 0.5, -1, 1) → posneg_{blue}
  6. If(rand_{bag-red} > 0.5, 1, -1) → posneg_{red}
  7. Circle(Drawn_{marble-center}, 0.3) → MarbleDrawnCircleRed
  8. Circle(Drawn_{marble-center}, 0.3) → MarbleDrawnCircleGreen
  9. Circle(Drawn_{marble-center}, 0.3) → MarbleDrawnCircleBlue
  10. Circle(Drawn_{marble-center}, 0.3) → f
  11. Sequence((x(Marble_{bag-center}) + i * posneg_{red} * 0.05 * random(), y(Marble_{bag-center}) + 0.15 + 0.4 * random()), i, -8, R2 - 9) → Add_{marbles-to-bag-red}
  12. If(rand_{bag-green} > 0.5, -1, 1) → posneg_{green}
  13. Sequence((x(Marble_{bag-center}) + i * posneg_{green} * 0.05 * random(), y(Marble_{bag-center}) + 0.2 + 0.4 * random()), i, -8, G2 - 9) → Add_{marbles-to-bag-green}
  14. If(rand_{bag-purple} < 0.5, 1, -1) → posneg_{purple}
  15. Sequence((x(Marble_{bag-center}) + i * posneg_{purple} * 0.05 * random(), y(Marble_{bag-center}) + 0.25 + 0.5 * random()), i, -8, P2 - 9) → Add_{marbles-bag-purple}
  16. Sequence(ceil((random() + a - a) * (B + R2 + G2 + P2)) + i - i, i, 1, a) → List_{colors}
  17. CountIf(x ≤ B, List_{colors}) → Count_{blue}
  18. CountIf(B < x ≤ B + R2, List_{colors}) → Count_{red}
  19. CountIf(B + R2 < x ≤ B + R2 + G2, List_{colors}) → Count_{green}
  20. CountIf(B + R2 + G2 < x ≤ B + R2 + G2 + P2, List_{colors}) → Count_{purple}
  21. Circle((x(Marble_{bag-center}), y(Marble_{bag-center})), 0.03) → Marble_{blue}
  22. Vector(Marble_{bag-center}, D) → v
  23. Element(List_{colors}, a) → MarbleDrawnValue
  24. Sequence((x(Marble_{bag-center}) + i * posneg_{blue} * 0.05 * random(), y(Marble_{bag-center}) + 0.1 + 0.4 * random()), i, -8, B2 - 9) → Add_{marbles-to-bag-blue}
  25. Polygon(BlueBarBottomLeft, BlueBarBottomRt, BlueBarTopRt, BlueBarTopLeft) → BlueBar, a_1, c_1, e_1, f_1
  26. Polygon(RedBarBottomLeft, RedBarBottomRt, RedBarTopRt, RedBarTopLeft) → RedBar, a_2, c_2, e_2, f_2
  27. Midpoint(BlueBarTopLeft, BlueBarTopRt) → BlueBarTopMidpoint
  28. Polygon(GreenBarBottomLeft, GreenBarBottomRt, GreenBarTopRt, GreenBarTopLeft) → GreenBar, a_3, c, e, f_3
  29. Polygon(PurpleBarBottomLeft, PurpleBarBottomRt, PurpleBarTopRt, PurpleBarTopLeft) → PurpleBar, h, i, j, k
  30. Midpoint(RedBarTopLeft, RedBarTopRt) → RedBarTopMidpt
  31. Midpoint(GreenBarTopLeft, GreenBarTopRt) → GreenBarTopMidpt
  32. Midpoint(PurpleBarTopLeft, PurpleBarTopRt) → PurpleBarTopMidpt
  33. Line(DividerLeft, DividerRight) → l

AI Drawing Prompt Reference

Simulate randomly drawing marbles of different colors from a bag and display the probability distribution of the results using bar charts. Draw the bag and place randomly generated red, green, and purple marbles inside it. Simulate the drawing process by placing a drawn marble at the center, and use bar charts to show the count distribution of each color.
The prompt above was compiled from the original drawing commands and is for reference only.