Add a parameter to a function
a) Implement dicho_0
that finds x in the interval ]a,b[ such as f(x) = 0, using the dichotomic method:
let rec dicho_0 f a b = ... ;; val dicho_0 : (float -> float) -> float -> float -> float = <fun>
b) Use dicho_0
to implement a one-line function dicho_y
that finds x such as f(x) = y :
let dicho_y y f a b = dicho_0 ... ;; val dicho_y : float -> (float -> float) -> float -> float -> float = <fun>
Note this is the reverse of specialisation by partial application:
let dicho_0 = dicho_y 0;;