Open postmath opened 1 year ago
Agreed, but arb_pow
ought to have such a special case for any x containing 0, not necessarily of the form [a +- a]
.
Hmm, but if there are negative numbers in x
, and y
is not an exact integer, the result isn't real, is it? So in that case I think the current answer of nan
is correct.
Ah yes, you're right of course. So this really is a special special case.
The more general case would be relevant in acb_pow
and acb_pow_arb
.
Agreed, acb_pow
and acb_pow_arb
are a bit more complicated. I guess for acb_pow_arb
you could reason that, with 0 \in x
and y
real:
x^y = exp(y * ln(x))
= exp(y * ([-infinity, max(abs(x))] + i * acb_arg(x)))
= [0, exp(max(y) * max(abs(x)))] * exp(i * y * acb_arg(x))
I suppose we could at least do a case distinction there between x
being contained in any quadrants, vs containing 0 in its interior, to compute that second factor.
The acb_pow
case would be another step messier. Would you be opposed to merging just this change to arb_pow
for now? If not I can prepare a pull request next week.
Patching arb_pow
is fine.
Consider
arb_pow(z, x, y, prec)
withx = <a +- a>
andy
nonnegative. This works as I would expect forx=0
, and also for exact half integersy
, includingy = 0
. But ifa > 0
andy
is not an exact half integer, thenarb_pow
returns a non-finite answer (because it takes the logarithm ofx
, then multiplies byy
, then takes the exponential; but we can't represent the half-infinite interval that the logarithm requires), whereas there is a finite answer. I propose to do roughly this, after all existing special cases have been done: