Exercise 2.97
-
Implement this algorithm as a procedure
reduce-termsthat takes two term listsnanddas arguments and returns a listnn,dd, which arenanddreduced to lowest terms via the algorithm given above. Also write a procedurereduce-poly, analogous toadd-poly, that checks to see if the two polys have the same variable. If so,reduce-polystrips off the variable and passes the problem toreduce-terms, then reattaches the variable to the two term lists supplied byreduce-terms. -
Define a procedure analogous to
reduce-termsthat does what the originalmake-ratdid for integers:(define (reduce-integers n d) (let ((g (gcd n d))) (list (/ n g) (/ d g))))and define
reduceas a generic operation that callsapply-genericto dispatch to eitherreduce-poly(forpolynomialarguments) orreduce-integers(forscheme-numberarguments). You can now easily make the rational-arithmetic package reduce fractions to lowest terms by havingmake-ratcallreducebefore combining the given numerator and denominator to form a rational number. The system now handles rational expressions in either integers or polynomials. To test your program, try the example at the beginning of this extended exercise:(define p1 (make-polynomial 'x '((1 1)(0 1)))) (define p2 (make-polynomial 'x '((3 1)(0 -1)))) (define p3 (make-polynomial 'x '((1 1)))) (define p4 (make-polynomial 'x '((2 1)(0 -1)))) (define rf1 (make-rational p1 p2)) (define rf2 (make-rational p3 p4)) (add rf1 rf2)See if you get the correct answer, correctly reduced to lowest terms.

Comments
Just getting back here Hmm, I don’t rbemmeer what I did when I looked at this before. I’m sure it’s on a scrap of paper at my house in California, but I’m in Michigan for the holidays. I just thought it through again and That line (We can take the derivative of both sides as many times as we want to see that f^{(i)}(\pi x) = f^{(i)}(x) for any i, as well.) makes perfect sense to me now. If two functions are equal (for all values of the variable), I’d guess their derivatives must be equal. I have a few questions still:What does it mean to take the derivative of f(pi-x)? Are we talking about df/dx or df/d(pi-x)? (Your last comment isn’t making sense to me, and I thought this might be where I’m not following you.)Calling f a’ function, when it depends on values of n, is still bothering me. Does it work to think of this as a collection of functions, where f sub n is as you gave f?You mentioned on your previous post that you’d be interested in working through other interesting proofs. Sam Shah just mentioned the on his blog. That’s something I’ve always been intrigued by, and never learned the proof of.This is something that never would have happened before the internet. I appreciate the opportunity to learn more mathematics.
Post new comment