EXERCISE 1 Suppose that nValues and dValues are functions of one argument (the termindex)that return the ni and di of the terms of the continued fraction. Define the function cont-frac such that evaluating cont-frac(k) computes the value of the k-term finite continued fraction. Check your procedures by approximating 1/φ using constant functions nValues and dValues that return the value 1 for any input value.
EXERCISE 2 One of the first formulas for π was given around 1658 by the English mathematician Lord Brouncker:
4/π−1=1/(2+9/(2+25/(2+49/(2+81/(2+··· Define a function estimate-pi(k) that uses cont-frac and appropriately defined nValues and dValues functions to estimate the value of π