ex2.5.hs 666 B

1234567891011121314151617181920212223242526272829303132333435
  1. -- Exercise 2.5
  2. -- George C. Privon
  3. -- 2023-09-05
  4. -- a) cube root of x
  5. cuberoot :: Double -> Double
  6. cuberoot x = x ** (1/3)
  7. -- b) e^y + 8^y
  8. exp8 :: Double -> Double
  9. exp8 x = exp x + 8**x
  10. -- c) 1/sqrt((x-5)^2 + 16)
  11. h :: Double -> Double
  12. h x = 1 / (sqrt $ (x-5)^2 + 16)
  13. -- d) 1 / sqrt(1-beta^2)
  14. gamma :: Double -> Double
  15. gamma x = 1 / (sqrt $ 1 - x^2)
  16. -- e) 1/(10+x) + 1 / (10-x)
  17. bigU :: Double -> Double
  18. bigU x = 1 / (10 + x) + 1 / (10-x)
  19. -- f) sqrt(l*(l+1)
  20. bigL :: Double -> Double
  21. bigL x = sqrt $ x * (x + x)
  22. -- g) 1 / abs(x)^3
  23. bigE :: Double -> Double
  24. bigE x = 1 / (abs x)^3
  25. -- h) 1/ (x^2 + 4)^3/2
  26. bigE2 :: Double -> Double
  27. bigE2 x = 1 / (x^2 + 4) ** 1.5