| Copyright | (c) Eric Zoerner 2023 |
|---|---|
| License | BSD3 |
| Maintainer | eric.zoerner@proton.me |
| Safe Haskell | Safe-Inferred |
| Language | GHC2021 |
Chapter01
Description
Synopsis
Exercise 1.1.
Why is sin 30 not equal to 0.5?
>>>sin 30-0.9880316240928618
Because sin expects the angle in radians.
>>>sin (30/180 * pi)0.49999999999999994
Exercise 1.2.
(a) 2 ^ (3 ^ 4) (b) (2 / 3) / 4 (c) 7 - (5 / 4) (d) (log 49) / 7
Exercise 1.3.
>>>logBase 2 325.0
Exercise 1.4.
Calculate the polar coordinates (r,θ) for Cartesian coordinates (x, y) = (–3,4).
>>>theta = atan2 4 (-3)>>>x = -3>>>y = 4>>>θ = atan2 y x>>>r = sqrt (x**2 + y**2)>>>(r, θ)(5.0,2.214297435588181)
Exercise 1.5.
Find a new example of a non-exact calculation result.
>>>3 ** (logBase 3 10)10.000000000000002
Exercise 1.6.
Why does associativity not apply for the equality, inequality, and comparison operators?
3 < 4 < 5
Because comparison, equality, and inequality operators evaluate to Boolean values which cannot be further operated on with these same operators.