A negative base raised to a rational exponent should not produce a co…#1644
A negative base raised to a rational exponent should not produce a co…#1644Geropy wants to merge 1 commit into
Conversation
…mplex number if the denominator of the exponent is odd; the result should be real. Added is_even() method to Integer to help accomplish this
|
I agree that there is a discrepancy between @certik, thoughts? |
|
The result of |
|
The result of |
|
closed by accident |
|
ping @certik |
|
The RCP<const Basic> cbrt(RCP<const Basic> &arg)
{
return pow(arg, div(one, i3));
}Which makes sense. Now let's do the calculation: So mathematically, it must be https://www.theoretical-physics.com/dev/math/complex.html I understand that @Geropy, @isuruf what is the exact definition of Update: I see how: if we define where The last exponential: So https://www.theoretical-physics.com/dev/math/complex.html But instead of defining: one would have to define: And one could do this, and then indeed |
|
So for consistency, I would keep the current (complex) definitions of However, looking at the std::cbrt documentation, it looks like they define @Geropy what is your application of this? We could provide a new function |
|
The Looking into it a bit more, if you want to be more general, you could potentially implement something like the https://mathworld.wolfram.com/nthRoot.html |
|
@Geropy I see. I think you found it. What you want is the What does "real valued" |
|
In the "Possible issues" of the Surd definition, it says that it is undefined for even n's and negative real x |
|
I was working on this argument and I came across this discussion. This is what I did. It should be self explanatory by means of comments. Maybe you find bugs there or how to do things better. The FIKE algorithm should do better results. |
…mplex number if the denominator of the exponent is odd; the result should be real.
For example -8 ^ (1/3) should return -2, not a complex number
Added is_even() method to Integer to help accomplish this