Exercise 2.97

Printer-friendly versionPrinter-friendly version
  1. Implement this algorithm as a procedure reduce-terms that takes two term lists n and d as arguments and returns a list nn, dd, which are n and d reduced to lowest terms via the algorithm given above. Also write a procedure reduce-poly, analogous to add-poly, that checks to see if the two polys have the same variable. If so, reduce-poly strips off the variable and passes the problem to reduce-terms, then reattaches the variable to the two term lists supplied by reduce-terms.

  2. Define a procedure analogous to reduce-terms that does what the original make-rat did for integers:

    (define (reduce-integers n d)
      (let ((g (gcd n d)))
        (list (/ n g) (/ d g))))

    and define reduce as a generic operation that calls apply-generic to dispatch to either reduce-poly (for polynomial arguments) or reduce-integers (for scheme-number arguments). You can now easily make the rational-arithmetic package reduce fractions to lowest terms by having make-rat call reduce before 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.

Corresponding Section: 


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.

Easter is аlso used to refer to a ρarticular season οf the church ƴear cawlled the Easter Season , οr “Eastertide”.
They woulԁ stroll սp and dowqn Fifth avenue to show off their Easter hats ɑnԁ outfits.

ϲom is a peach and spring green layout tɦat showcases adorable flower, sun, аnd swirl accents to highlight ʏօur pictures.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <hr> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.
  • Adds typographic refinements.

More information about formatting options