solutions-learn-physics-with-fp-0.1.0.0
Copyright(c) Eric Zoerner 2023
LicenseBSD3
Maintainereric.zoerner@proton.me
Safe HaskellSafe-Inferred
LanguageGHC2021

Chapter02

Description

 
Synopsis

Exercise 2.1

f :: Floating a => a -> a Source #

f(x) = √ (1 + x)
>>> f 0
1.0
>>> f 1
1.4142135623730951
>>> f 3
2.0

Exercise 2.2.

stdGravityMPS2 :: Double Source #

Standard Earth gravity acceleration at sea level in m/s².

yRock30 :: Double -> Double Source #

Assuming an initial velocity of 30 m/s, accepts as input the time (after the rock was thrown) in seconds and gives as output the height of the rock in meters.

Exercise 2.3.

vRock30 :: Double -> Double Source #

Accepts as input the time (after the rock was thrown) in seconds and gives as output the upward velocity of the rock in meters per second. A downward velocity is returned as a negative number.

Exercise 2.4.

sinDeg :: Double -> Double Source #

Computes the sine of an angle given in degrees.

>>> sinDeg 30
0.49999999999999994

Exercise 2.5.

f25 :: Double -> Double Source #

f(x) = ∛x

g :: Double -> Double Source #

g(ɣ) = e^ɣ+8^ɣ

h :: Double -> Double Source #

h(x) = 1/√((x-5)²+16)

ɣ :: Double -> Double Source #

ɣ(β) = 1/√(1 - β²)

bigU :: Double -> Double Source #

U(x) = 1/(10+x)+1(10-x)

bigL :: Double -> Double Source #

L(l) = √(l(l + 1))

bigEx :: Double -> Double Source #

E(x) = 1 / (|x|³)

bigEz :: Double -> Double Source #

E(z) = 1 / (z²+4)^(3/2)

Exercise 2.6.

(a) b -> 1 / sqrt (1 - b ** 2)

(b)

>>> (\b -> 1 / sqrt (1 - b ** 2)) 0.8
1.666666666666667