ex2.3.hs 413 B

12345678910111213141516171819
  1. -- Exercise 2.3
  2. -- George C. Privon
  3. -- 2023-09-05
  4. -- Define a constant
  5. e :: Double
  6. e = exp 1
  7. -- Define a function
  8. square :: Double -> Double
  9. square x = x ^ 2
  10. -- height of rock as a function of time, with a starting upward speed of 30 m/s
  11. yRock30 :: Double -> Double
  12. yRock30 t = 0.5 * (-9.8) * square t + 30 * t
  13. -- velocity of rock as a function of time
  14. vRock30 :: Double -> Double
  15. vRock30 t = (-9.8) * t + 30