Re: Re: rationalize numerator of quotient

*To*: mathgroup at smc.vnet.net*Subject*: [mg81225] Re: [mg81208] Re: rationalize numerator of quotient*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Sun, 16 Sep 2007 04:08:00 -0400 (EDT)*References*: <29319569.1189724898261.JavaMail.root@eastrmwml14.mgt.cox.net> <fcdf9p$plc$1@smc.vnet.net> <200709150818.EAA28315@smc.vnet.net>

On 15 Sep 2007, at 17:18, Peter Breitfeld wrote: > Murray Eisenberg schrieb: >> Thanks to all who replied, either here or privately. I didn't try >> the >> "obvious" method of using Simplify because, of course, I forgot >> Mathematica's conception of "simpler". >> >> And this is a good example where Mathematica's "simplify" is >> contrary to >> what is taught in school about when a fraction is simpler -- in high >> school it is often (unfortunately) taught that one should >> "rationalize" >> the fraction so that the square-root is in the numerator and never in >> the denominator. Of course in calculus, when taking limits of such >> quotients, that is precisely what you do NOT want to do, but instead >> want to do what Mathematica's sense of simplifying here accomplishes. >> > [ little bit off-topic ] > > I think this is relict of the times roots had to be calculated by > hand. To calculate 1/Sqrt[2] you first had to calculate > Sqrt[2]=1.4142 and then divide 1/1.4142. This is more work to be > done than simply dividing Sqrt[2] by 2. > > Gruss Peter > -- > ==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-== > Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de > I don't think it is just a "relic" of "by hand" computations. The fact that a fraction like: (2 + Sqrt[2])/(3 - 5*Sqrt[2]) can be uniquely expressed in the form RationalizeDenominator[(2 + Sqrt[2])/(3 - 5*Sqrt[2]), Sqrt[2]] -(16/41) - (13*Sqrt[2])/41 (where the function RationalizeDenominator is defined by RationalizeDenominator[f_, a_] := Block[{t}, Numerator[f]* PolynomialExtendedGCD[Denominator[f] /. {a -> t}, MinimalPolynomial[a, t]][[2, 1]] /. t -> a // Expand] ) is both non-trivial and useful, not only for computational purposes (which in the computer age does not count for that much) but for mathematical ones. Its significance is exactly the same as that of the fact that (2 + I)/(3 - 5*I) can be uniquely expressed in the form ComplexExpand[(2 + I)/(3 - 5*I)] 1/34 + (13*I)/34 and I think it is pretty clear that the latter fact is not just a relic of "by hand" computations with complex numbers. In fact both of these facts are simply consequences (or illustrations) of the following basic lemma in field theory: Let E be a field, F a subfield and z an alement of E which is algebraic over F. Then the ring F[z] of polynomials in z with coefficients in F is a field. This is very useful for all kinds of mathematical reasons and, I think, the habit of "rationalizing the denominator" derives from derives more from the mathematical usefulness of this theorem rather than from computational convenience. And while I am at it: it may sound pedantic, but the "correct" way to deal with the original problem is: Cancel[(Sqrt[x] - 2)/(x - 4)] 1/(Sqrt[x] + 2) Of course Factor will also work, but in general it is wasteful as it will try to factor the entire expression when we actually only want to perform a cancellation. Simplify only works because it uses Cancel (and Factor); but in fact Simplify will not in general "rationalize" either the numerator or the denominator: FullSimplify[(Sqrt[x] - 1)/(x - 4)] (Sqrt[x] - 1)/(x - 4) and FullSimplify[(x - 4)/(Sqrt[x] - 1)] (x - 4)/(Sqrt[x] - 1) The reaosn is not the "notion of simplicity" but simply the fact that FullSimplify lacks the encessary transformations to do that. (However, it is possible to make it do this in some cases involving algebraic numbers). The fucntion RationalizeDenominator defined above only works for numerical radicals. It would be possible to write its analogue for algebraic function fields but, unlike in the case of algebraic numbers, I don't think it woud be worth the effort. Andrzej Kozlowski

**References**:**Re: rationalize numerator of quotient***From:*Peter Breitfeld <phbrf@t-online.de>