More Notes on the Project: - The term xreal in the project code stands for an exact real, which is an interval determined by two rational numbers, which is represented by the abstract data type ratintvl. - The function (rational_power->xreal x y) produces a function that takes as argument a precision value and returns a rational interval that bounds x^y with the specified precision, e.g. ((rational_power->xreal 2 1/2) 1) --> (list 1 2) since to one digit precision, sqrt(2) is in the interval [1,2]. - The function (rational->xreal r) returns a the exact representaiton (that is, a rational interval) of r, the rational interval [r,r] and is independent of precision given. Propagating rational intervals through the basic arithmetic operations: - addition: to get a specified precision p in the sum, we require that the two operands have p/2 precision. There are more rigorous methods of handling this issue, but we will stick to this implementation. - subtraction: same as addition - multiplication: define an upper bound for each exact real argument by taking the max of the rational interval bounds. Then take as the required precision for each argument p/(2*m_other), where p is the desired precision for the product, and m_other is the bound determined for the other argument. The intuition is that if your set a total required precision then the required precision of each of the arguments must be inversely related. That is, the more precise x1 is, the less precise x2 has to be, and vice versa. For those who know some quantum mechanics, c.f. Heisenberg Uncertainty Principle. - division: left for the homework More on Rational Powers: - In the (rational_power->xreal r1 r2) function for computing r1^r2, we first split the exponent into its integer numerator and denominator. Taking r1 to the numerator of r2 produces an integer, so we redefine the base to be b=r1^numer(r2), and now the problem reduces to computing b^denom(r2), which isn't so easy as it involves taking roots. Taking r^(1/n) is equivalent to finding the solution to x^n - r = 0. There are two popular methods for tackling this problem: the bisection method and Newton's method. The bisection method involves shrinking an interval down around the solution(s) half each step. The idea is to cut the ith interval in half, determine which half contains the solution by testing in the equation, and defining the (i+1)st interval to be the half you chose. Newton's method involves using first derivaties of the function you are trying to solve to set the successive intervals. This speeds up the algorithm quite a bit. Still, we won't be calling on Newton for this project.