Advertisement
Guest User

Untitled

a guest
Oct 16th, 2016
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.85 KB | None | 0 0
  1. ;; Complete the following functions
  2.  
  3. ;; compute constant acceleration
  4. ;; a = (2s) / (t^2)
  5. (define (const-accel s t)
  6.   (/ (* s 2) (* t t)))
  7.  
  8. ;; find Usain's acceleration (100m)
  9. (define usain-accel-100 (const-accel 100 time-100))
  10.  
  11. ;; find Usain's final speed (100m)
  12. (define usain-v-final-100
  13.   (* time-100 usain-accel-100))
  14.  
  15. (define (square x) (* x x))
  16.  
  17. ;; find amount of for Usain to reach max speed (200m)
  18. (define usain-t-v-max-200
  19.   (- time-200
  20.      (sqrt(-
  21.            (square time-200)
  22.            (/ 400 usain-accel-100)))))
  23.  
  24. ;; find Usain's max speed (200m)
  25. (define usain-v-max-200
  26.   (* usain-accel-100 usain-t-v-max-200))
  27.  
  28. ;; find Usain's time (second 100m)
  29. (define usain-t-2nd-100-of-200
  30.  (if (<= (* 0.5 usain-accel-100 (square usain-t-v-max-200) ) 100)
  31.      (/ 100 usain-v-max-200)
  32.      (- time-200 (sqrt (/ 200 usain-accel-100)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement