22b. List Exercises 3
Randomly generate points on a parabola and graph them in people coordinates.
Note: This page uses MathJax to show fancy formulas.
-
random-gen: number(N) -> list of numbers. GenerateNrandom numbers, each one in the interval . Example (random so numbers will be different each time):(random-gen 5) => (list -75 100 -30 50 21) -
parabola-it: list of numbers -> list of posn. Use the numbers as the x-coordinates of function(parabola-it (list 5 10)) => (list (make-posn 5 -49.75) (make-posn 10 -49)) -
people-graph: list of posn -> image. Place the posns in people coordinates on a 300x200 rectangle with origin at the center.
A quick check to make sure everything is in order is to run all of the functions together:
(people-graph (parabola-it (random-gen 50)))