Write a function `fixedPoint` with the following signature:
```scala
deffixedPoint(f:Int=>Int):Int=>Int
```
The function takes a function `f` and returns a function that maps an integer into the fixed point of f that is obtained by iterating `f` some finite number of times starting from the initial value.
A value `x` is a fixed point of `f` if `f(x) == x`.
For each of the following expressions, indicate whether it terminates, and if so, what is the value returned:
-`fixedPoint(x => x/2)(4)`
-`fixedPoint(id)(123456)`
-`fixedPoint(x => x + 1)(0)`
-`fixedPoint(x => if (x % 10 == 0) x else x + 1)(35)`
-`fixedPoint((x: Int) => x / 2 + 5)(20)`
## Exercise 5.1
Write the `sum` function with the following signature:
```scala
defsum(a:Int,b:Int)(f:Int=>Int):Int=???
```
Which returns the sum of `f(i)` where `i` ranges from `a` to `b`.
_Bonus point_: Can your implementation be tail recursive ?
## Exercise 5.2
Write the `quadratic` function with the following signature:
```scala
defquadratic(c:Int):Int=>Int=???
```
Which returns a function that takes an integer `x` as argument and returns `(x - c)²`.
## Exercise 5.3
Using the above functions, define the function `quad3Integrate` which, given two integers `a` and `b`, computes the sum of `(i - 3)²` where `i` ranges from `a` to `b - 1`.