Number Models 5

  1. Write a function q1 that produces a random number from the set { 50, 130, 210, 290, 370, 450, 530 }, each one equally likely.

  2. Write a function q2 that produces a random number from the set { 25, 36, 49, 64, 81}, each one equally likely. (A little thinking and math is needed.)

  3. Describe in words a strategy you could use in order to create a function that prints out a random sized square above an image of the text “Area: XXX”? (Where XXX = the actual area of the shape.)

  4. Actually do the strategy you explained in 3.

  5. Make an animation where a dot follows the graph of $$ f(x) = 0.001 (x-30)(x-10)(x+40), $$ with a display window [-50,50]x[-50,50] with visible axes.

    • Write two check-expects that show that you have typed your function $f$ correctly.
    • As time passes the dot moves to the right (along the graph)
    • Hitting a key makes the dot jump to a random location (on the graph).
    • When the mouse is moving, the dot moves to the left (along the graph).
Last modified August 18, 2023: 2022-2023 End State (7352e87)