Write a user-defined function with function call m = midpoint_ seq(a,b,tol) where a and b are constants such that a 2of [a, m1], then the midpoint m3 of [a, m2], and so on.
The process terminates when two successive midpoints are within tol of each other.
Allow a maximum of 20 iterations. The output of the function is the sequence m1, m2, m3, . . . . Execute the function for a = -4, b = 10, tol = 10-3.