Probability Models in Cookie Ingredients

Probability Models in Cookie Ingredients
Loading the math board and drawing, please wait…
2023-07-27 23:33
This example demonstrates probability models using bar graphs to visualize cookie topping frequencies. Key concepts include probability, frequency, and data visualization. Construction involves GeoGebra commands like BarChart and RandomUniform. Suitable for grades 6-8 in statistics and probability education.

GeoGebra Commands & Parameters

  1. RandomUniform(0, 0.99, 200) → allRandomSeeds, {0.9064980580961615, 0.7883330799764553, 0.19128575540605944, 0.2240338805383391, 0.17447995660816482, 0.052772053381752754, 0.7139692515865531, 0.628335415443585, 0.5976098983988584, 0.857802428704047, 0.19412731009430323, 0.14582161084410622, 0.18179862805624677, 0.7569167562869002, 0.04036425567121437, 0.1293707809881714, 0.9289142864231259, 0.4240521136825159, 0.18977913243407443, 0.350694411678108, 0.014383043926408002, 0.4371435882810758, 0.12135215799583529, 0.8733120471630028, 0.018253376195172807, 0.42273646525394587, 0.6406207044659178, 0.21227553272729954, 0.5734397433387318, 0.7235050734477635, 0.18013681399705883, 0.3515090139878073, 0.0600857835235189, 0.44410960897056995, 0.781516380016482, 0.9330589967982462, 0.9198990328486611, 0.12159486084190897, 0.11089619177493337, 0.43816358861013543, 0.5289093745821424, 0.8744927401730133, 0.2603082527522874, 0.6678531746057637, 0.9513897182643934, 0.149937492929613, 0.8328615558332118, 0.610784798944692, 0.17165304373469448, 0.28043631734685354, 0.49969033158383397, 0.5181903966915694, 0.8741007566817723, 0.6814597989073239, 0.9413829544190095, 0.8601840620689782, 0.44524852787651836, 0.02772514481738545, 0.7260496585586066, 0.5342264074512958, 0.6444910253789263, 0.06994207708238394, 0.07031762108627508, 0.975284396180421, 0.3330933672678453, 0.6548751599030472, 0.6883607161727554, 0.7481525995594276, 0.8233079505843094, 0.049847514475661533, 0.8175767688800384, 0.9555168998044561, 0.4416155216814475, 0.50827030077151, 0.557718751863934, 0.7306450624288349, 0.591876214888619, 0.7954284725208373, 0.343167011586078, 0.6210778846396752, 0.8656511427700855, 0.4635876284003781, 0.6255982117175033, 0.3193732723533407, 0.8081170724080773, 0.4825077993541566, 0.6165622076141896, 0.6988201996356742, 0.32884601885310216, 0.9856595435792165, 0.696421903772509, 0.4560924063374713, 0.42725963061497163, 0.08383381969744197, 0.2077415257712788, 0.9790522285786848, 0.3927916545740424, 0.7964211617137307, 0.3075272083529113, 0.3463422474072504, 0.5997047680883608, 0.5164073914864976, 0.06373012595452565, 0.2960178111137084, 0.9561072908686538, 0.7280916347362891, 0.1671149041779517, 0.2732765085086133, 0.31600261191243156, 0.2966794663415275, 0.5199778483367261, 0.3623305768543106, 0.24217830399383525, 0.7462374755075427, 0.4982668907967608, 0.8346458157020699, 0.3864047676767218, 0.1270173881341331, 0.7034121639286368, 0.885136466210106, 0.8417622079200704, 0.15486663713295507, 0.14461832446857006, 0.5094576245545838, 0.11995196764307592, 0.29433884619236994, 0.8415013480481901, 0.3692771973516845, 0.8541732962999645, 0.3532017345023631, 0.5407707061962475, 0.6383370849251492, 0.02555813087953048, 0.7693113559707646, 0.3191635911279431, 0.43022885862712534, 0.8982564918447705, 0.8512805777664756, 0.08803118087190352, 0.4191114125657772, 0.3450519951230082, 0.28201614684640014, 0.41285817804034947, 0.7970885259952701, 0.5918617417405887, 0.2890328549989893, 0.3635644756011644, 0.40664218841848826, 0.3256368789826021, 0.7974745880305864, 0.0886946495262358, 0.15338256108858994, 0.9160296375772432, 0.5909810968778575, 0.29854324511402025, 0.5834281366539464, 0.41672990389505027, 0.3019358773596531, 0.2288957744870067, 0.3909701016850263, 0.417599222241712, 0.7562145024717724, 0.2483826991232367, 0.10500247040896708, 0.9136412860767081, 0.6183241460826087, 0.21845035736708104, 0.21981495026107936, 0.18144914169396992, 0.690784061384462, 0.5056455819573025, 0.13164786521769467, 0.7180547992252966, 0.7867435495116287, 0.7712918790368031, 0.9538994830466437, 0.08108274264945914, 0.0971672636759488, 0.8337034014571255, 0.5154526253923705, 0.1327703943955495, 0.25343993184153224, 0.39283872248756535, 0.021054028664334225, 0.7437682962142692, 0.4529511057281349, 0.9167396897965363, 0.1692315090326026, 0.9656698196394212, 0.7191171113028992, 0.8432320186297602, 0.4619749773461368, 0.17394519190771104, 0.5383815285762906, 0.8791815251391734, 0.30133463677363564, 0.435366070937406, 0.6950066911262015, 0.5831072839415583, 0.5812052542119974}
  2. Element(cookiesSelected, Length[cookiesSelected]) → currentCookieIndex
  3. Zip(3 < animateControl < maxAnimate ∧ Defined[IndexOf[A, currentCookieIngredientsIndex]], A, {1, 2, 3, 4, 5, 6}) → highlightLabel
  4. Take(allRandomSeeds, maxRandIndex - numRandoms + 1, maxRandIndex) → currentRandomSeeds
  5. If(countQuestion ≤ 1, 7, 2 + floor((currentRandomSeeds(2) * 12))) → numCookies
  6. Take(Element[possibleOrders, orderIndex], 1, numCookies) → cookieIndex
  7. Zip(Element[cookieImages, A], A, cookieIndex) → chosenCookieImages
  8. PixelsToPoint(Corner[1], Corner[3], Corner[5], (800 - 16, 500 - 16 - 36 - 16)) → bagBottomRight
  9. PixelsToPoint(Corner[1], Corner[3], Corner[5], (435, 500 - 16 - 36 - 16)) → BagBottomLeft
  10. Translate(listFirstCookieLocations, Vector[CookieStart, CookieStart + (0, (imgSize * 2) + (imgSpace * 2))]) → listSecondCookieLocations
  11. Join({listFirstCookieLocations, listSecondCookieLocations}) → listCookieLocations
  12. Zip(Translate[A, Vector[B]], A, chosenCookieImages, Vector[B], Zip[Vector[ImageStart, K], K, listCookieLocations]) → TranslatedCookieImages
  13. Element(TranslatedCookieImages, 13) → cookieImg13
  14. Element(TranslatedCookieImages, 12) → cookieImg12
  15. Element(TranslatedCookieImages, 11) → cookieImg11
  16. Element(TranslatedCookieImages, 10) → cookieImg10
  17. Element(TranslatedCookieImages, 9) → cookieImg9
  18. Element(TranslatedCookieImages, 8) → cookieImg8
  19. Element(TranslatedCookieImages, 7) → cookieImg7
  20. Element(TranslatedCookieImages, 6) → cookieImg6
  21. Element(TranslatedCookieImages, 5) → cookieImg5
  22. Element(TranslatedCookieImages, 4) → cookieImg4
  23. Element(TranslatedCookieImages, 3) → cookieImg3
  24. Element(TranslatedCookieImages, 2) → cookieImg2
  25. Element(TranslatedCookieImages, 1) → cookieImg1
  26. Zip(axisOrigin + (0.5 + A, If[B, 0.45, 0.2]), A, {0, 1, 2, 3, 4, 5}, B, highlightLabel) → horizontalLabelLoc
  27. Zip(horizontalLabelLoc(A), A, currentCookieIngredientsIndex) → currentCookieIngredientsLocFinal
  28. Textfield(input1) → InputBox1
  29. Corner(5) → layoutAppSize
  30. PointToPixels(Corner[onboardingDisplayText, 2], Corner[1], Corner[3], Corner[5]) → layoutOnboarding
  31. onboardingTextOffset(Corner[onboardingText, 1], Corner[onboardingText, 3], onboardingCase, Corner[1], Corner[3], Corner[5]) → OnboardingTextOffset
  32. Zip(Element[cookieNames, A], A, cookieIndex) → chosenCookieNames
  33. Element(cookieNames, chosenCookieIndex) → chosenCookies
  34. Flatten(Zip[Element[cookieIngredients, K], K, Take[cookiesSelected, 1, If[animateControl ≟ maxAnimate, Length[cookiesSelected], Length[cookiesSelected] - 1]]]) → ingredientFrequencyList
  35. Element(listCookieLocations, IndexOf[currentCookieIndex, cookieIndex]) → currentCookieLocationBag
  36. Segment(axisOrigin, (Length[possibleIngredients], 0) + axisOrigin) → horizontalAxis
  37. Sequence(Segment[axisOrigin + (0, ((0.1 * k) * axisHeight)), axisOrigin + (Length[possibleIngredients], ((0.1 * k) * axisHeight))], k, 1, 10) → horizontalLines
  38. Segment(axisOrigin, (x(axisOrigin), axisHeight + 0.25)) → verticalAxis
  39. Zip(Text[A, B + (-0.05, 0.05), true, true, -1, 0], A, Sequence[(k * 0.2), k, 1, 5], B, Sequence[axisOrigin + (k * (0, (0.2 * axisHeight))), k, 1, 5]) → verticalLabelsPercent
  40. Sequence(Segment[axisOrigin + (-0.1, ((0.2 * k) * axisHeight)), axisOrigin + (0.1, ((0.2 * k) * axisHeight))], k, 1, 5) → horizontalTicks
  41. Min(1, animateControl) → animateCookie
  42. Min(Max[0, animateControl - 2], 1) → animateIngredientsA
  43. Vector(currentCookieLocationBag, currentCookieLocation) → cookieVector
  44. Translate(Element[cookieImages, currentCookieIndex], Vector[ImageStart, currentCookieLocationBag + (animateCookie * cookieVector)]) → chosenCookieImage
  45. Zip(possibleIngredients(A), A, currentCookieIngredientsIndex) → currentCookieIngredients
  46. Zip(Vector[middleCookieLocation, A], A, currentCookieIngredientsLocFinal) → currentCookieIngredientsVec
  47. Sequence(Length[KeepIf[x ≟ A, ingredientFrequencyList]], A, 1, 6) → ingredientObservations
  48. If(animateControl ≟ maxAnimate, numTrials, numTrials - 1) → numTrialsFinal
  49. Zip((A / numTrialsFinal * axisHeight), A, ingredientObservations) → ingredientProbability
  50. BarChart({1, 2, 3, 4, 5, 6}, ingredientProbability, 0.5) → barChartPercents
  51. If(Max[ingredientObservations] ≤ 5, 5, (ceil(Max[ingredientObservations] / 10) * 10)) → frequencyHeight
  52. BarChart(ingredientFrequencyList, 0.5, axisHeight / frequencyHeight) → barChartFrequency
  53. Zip(Text[A, B + (-0.05, 0.05), true, true, -1, 0], A, Sequence[(k * frequencyHeight / 5), k, 1, 5], B, Sequence[axisOrigin + (k * (0, (0.2 * axisHeight))), k, 1, 5]) → verticalLabelsFrequency
  54. PixelsToPoint(Corner[1], Corner[3], Corner[5], (435, 60)) → BagTopLeft
  55. expandCircle(listCookieLocations(numCookies) + (imgSize / 2, imgSize / 2), 26 + (8 * pulsing), Corner[1], Corner[3], Corner[5]) → pulsingCircle
  56. Zip((("SetFixed(cookieImg" * A) * ",true,true)"), A, Sequence[13]) → cmdUnfixCookieImgs
  57. Zip((("SetFixed(cookieImg" * A) * ",true,false)"), A, Sequence[13]) → cmdFixCookieImgs
  58. Min(Max[0, animateControl - 1], 1) → animateIngredientsB
  59. Zip(middleCookieLocation + (A, -0.5), A, cookieStartOffsets) → ingredientStartPositions
  60. Zip(Text[RotateText[A, pi / 2], B + (animateIngredientsA * (C - B)), true, true, 0, -1], A, currentCookieIngredients, B, ingredientStartPositions, C, currentCookieIngredientsLocFinal) → currentCookieIngredientsText
  61. Zip(Text[((If[C, "\textbf{", ""] * RotateText[A, pi / 2]) * If[C, "}", ""]), B, true, true, 0, -1], A, possibleIngredients, B, horizontalLabelLoc, C, highlightLabel) → horizonalLabels

AI Drawing Prompt Reference

Draw a bag containing multiple chocolate cookies with different ingredients such as chocolate chips, nuts, and sugar. Below the bag, draw a bar chart showing the frequency of each ingredient. At the bottom of the chart, list the ingredient names, and at the top, show the corresponding frequency heights. Animate the process of randomly selecting a cookie from the bag and updating the ingredient frequency in the bar chart.
The prompt above was compiled from the original drawing commands and is for reference only.