[Python-Dev] PEP239 (Rational Numbers) Reference Implementation and new issues

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Fri Oct 4 06:21:37 EDT 2002


Michael Hudson <mwh at python.net> writes:
> > My own faded memory says: L'Hopital's Rule. Differentiate top
> > and bottom and take the limit of that instead. Repeat until
> > top and bottom don't both go to 0.
> 
> That's about right.  You need some assumptions about the functions
> involved.  An obvious one: they have to be differentiable.  I wonder
> if they have to be analytic?  Probably not.
> 
> > There's no doubt some terribly good reason why this works,
> > 
> > but I can't remember it, if I ever knew...
> 
> Doesn't just need expanding both functions as a power series around
> the limit point work?  (I guess you do need analyticity for this...)

I think it's enough for f and g to be differentiable at x0 on the real
axis, and f' and g' continuous at x0, and g'(x0) nonzero.  f and g don't
have to be analytic.

Say f(x0) = 0.  Then f(x) ~= (x-x0)f'(x) for x near x0.  ~= means
approximately equal.  This is from the definition of a derivative.
For any epsilon there's a neighborhood of x0 where
|f(x)-(x-x0)f'(x)| < epsilon.

Similarly say g(x0) = 0.  Then g(x) ~= (x-x0)g'(x) for x near x0.
And for any epsilon |g(x)-(x-x0)g'(x)| if x is close enough to x0.

Choose some e < (1/2) * min(|f'(x0)|, |g'(x0)|).

Then f(x)/g(x) is within 4*e of f'(x0)/g'(x0) for x near enough to x0.

So if 4*e < epsilon, then |f(x)/g(x) - f'(x0)/g'(x0)| < epsilon in
that same neighborhood.

So f(x)/g(x) ~= f'(x)/g'(x) for x near x0.

I'm pretty sleepy so may have made a mistake somewhere ;-)



More information about the Python-list mailing list