Mathematics in Python are not correct
Lou Pecora
pecora at anvil.nrl.navy.mil
Mon May 12 11:50:19 EDT 2008
In article <mailman.962.1210572565.12834.python-list at python.org>,
"Terry Reedy" <tjreedy at udel.edu> wrote:
> "Mark Dickinson" <dickinsm at gmail.com> wrote in message
> news:6b64d8f4-3f61-4295-9298-4633214d1e94 at m73g2000hsh.googlegroups.com...
> On May 11, 9:36 pm, "Terry Reedy" <tjre... at udel.edu> wrote:
> |> Do you have in mind any situations in which it is advantageous to have
> 0**0
> |> undefined?
>
> | (Playing devil's advocate here.) If you regard x**y as exp(y*log(x))
>
> Which, of course, I was not, but for the sake of discussion....
>
> | then it's not at all clear that 0.**0. should be considered well-defined.
>
> Then it seems equally dubious that 0.**y, y>0, should be well-defined.
> It seems to me that lim as x goes to 0. exp(y*log(x)) is equally well
> defined whether y is 0 or not, even though there is a discontinuity in the
> limit.
Huh? That "discontinuity" is the problem. Actually, the problem is
that the function f(x,y)=x**y=exp(y*ln(x)) will be double valued at x=0
and y=0. It's value will depend on the direction in which the limit
approaches (x,y)=(0,0). You cannot have a function that has two values
at one domain point without adding branch cuts (see complex functions
like ln(z), z is complex). That's not well defined -- in your sense.
You are choosing a branch cut and you must make sure the rest of your
math and code are consistent with that. You should also tell any users
of your code about that decision.
--
-- Lou Pecora
More information about the Python-list
mailing list