You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My understanding is that all mathematical operations that work in the complex plane work the same way on the Riemann sphere. So the results of complex exponential operations that land in the complex plane get mapped to the appropriate place on the Riemann sphere. This includes zero and all four infinities (which map to the poles).
This is because
which means that if z = x + iy and z goes to infinity, then we cannot determine the limit of exp(z). For example, take the following z values: 0, i, 2i, 3i, .... Then the limit exp(0), exp(i), exp(2i), ... will be meaningless, as exp(n i) = cos n + i sin n, which is essentially a "random" point on the unit circle, clearly does not converge (neither to infinity, nor to any given complex number)
or, if you take the z values: 0, i*pi, 2 i*pi, 3 i*pi, etc. (clearly z goes to infinity) then the exp(z) values will be +1, -1, +1, ... as exp(n i pi) is -1 if n is odd and + 1 if n is even.
complex exponentiation is always tricky.
this is how wikipedia pictures the complex exp function. pretty cool. Brightness means the absolute value, color means the direction.
Now if you approach infinity "to the right", then you will have a sequence that also goes to infinity. However, if you approach it "to the top" (as in the example I wrote above), then you will be going around the unit circle. Same with the bottom direction.
If you go left (to the same complex infinity) than the exponentiation will go to zero...
I think Harry was asking about Infinity^z rather than z^Infinity. The first should be Infinity. I think you are correct that the second should be indeterminate (NaN).
z ^ Infinity is indeterminate, even if |z| < 1. This would require determining a definite limit for z ^ w (where w -> Infinity). However, unless z is a positive real number, such powers are difficult to calculate and some (most) do not even have a single well-defined value, but many different (sometimes infinitely many different) possible results. As I have said before, exponentiation on the complex plane is hard and counter-intuitive.
Quote from wikipedia:
"Trying to extend these functions to the general case of noninteger powers of complex numbers that are not positive reals leads to difficulties. Either we define discontinuous functions or multivalued functions. Neither of these options is entirely satisfactory."
In other words, z ^ w is better left undefined, unless z is a positive real.
This means that the infinite case, z ^ Infinity should, in my opinion, be indeterminate for the general case (z is not a positive real).
However, for the positive real case: this is also indeterminate, unless z = 1, which is the case above, and I am not sure about it. This case is basically very similar to e ^ Infinity, because a power a ^ w can be solved by writing a ^ w = e ^ (ln(a) w ). Then decompose w = x + i y, you get e ^ (ln(a) * (x + i y)), which is e ^ (ln(a) x + i ln(a) y) = a ^ x * (cos (ln(a) y) + i sin (ln(a) y). This is a bit of a mess at first sight, but it is essentially the same as the natural base case mentioned earlier, unlessa = 1. For a <> 1, you can always choose some silly w's, so that e.g. the real part of w (which is x) is fixed, and then you get "random" numbers on the circle with radius a^x, clearly divergent.
Infinity ^ 1 === Infinity that is correct by definition.
Infinity ^ z is, unfortunately, again indeterminate, unless z is a non-zero real number. However, for reals, this may have a value: Infinity ^ x is Infinity, if x is positive, 0 if x is negative. I am a bit tired to be 100% sure, but this is what Wolfram gives as a result and it seems ok.
Any exponentiation involving Infinity (either as base or exponent) is indeterminate, except:
(6) Infinity ^ 1 === Infinity,
(7a) Infinity ^ z === Infinity, if z is a positive real number (Im(z) === 0, Re(z) >0)
(7b) Infinity ^ z === 0, if z is a negative real number (Im(z) === 0, Re(z) < 0)
And, the only question is the result of 1 ^ Infinity, but I need some more time on that one. (but wolfram gives indeterminate for that as well)
For (7b) could we qnot have Infinity ^ z === 0 if the real part of z is negative. Wolfram agrees: .
I can buy that (1), (3) and (4) should all be NaN.
As for 1 ^ Infinity, could this not be 1? The best argument that I can think of against this is that it is z ^ Infinity is NaN for all z !== 1 so it might as well be NaN for 1 aswell.
On Mar 14, 2018, at 5:46 PM, Harry Sarson ***@***.***> wrote:
To summarise for any complex z:
z ^ Infinity === NaN
Infinity ^ z === Infinity if Im(z) === 0 and Re(z) > 0
Infinity ^ z === 0 if Re(z) < 0
Infinity ^ z === NaN otherwise
Question: should Infinity ^ 0 === 1 which would fit with behavour for Numbers in js?
I would think so, since I thought mathematicians had defined anything to the zeroth power as 1, but we should ask the real mathematician ;-)
So if we want to compute w^z, we must choose a branch cut of log(), normally (-pi, pi]
Then w must be written in polar decomposition w = r e^(i theta) (choosing theta so that pi < theta <= pi, the principal branch cut), and z in Cartesian decomposition z = c + d i). The following formula gives the result:
w^z = r^c e^(-d theta) (cos(d log(r) + c theta) + i sin (d log(r) + c theta))
This indeed converges if Re(z) = c < 0 (w -> Infinity) , because the r^c part will converge to 0, the e^(-d theta) part is within a fixed range (here we use heavily that theta is in a fixed finite interval), and the rest is just a point on the unit circle, again bounded.
Generally, with multi-valued powers, this does not work, because theta can have any value and might "work against" the r^c part, hence no convergence.
Bottom line: if Complex.js defines z^w using this approach of a fixed branch cut, then Infinity^z = 0 if Re(z) < 0. You are right, I was wrong. :)
Infinity ^ 0 cannot be computed with lim z^0 (z -> Infinity). (That approach would yield Infinity * 0 = 0 as well, clearly wrong, az Infinity * 0 is also indeterminate)
The right way is with lim z^w (z -> Infinity, w -> 0). And that does not converge generally.
Funny that javascript has Math.pow(Infinity,0) === 1. Yeah, that is a problem. But javascript also has Math.pow(-2, Infinity) === Infinity, which is even more silly. I do not know where they got that idea ...
It's not 100% clear to me whether this conversation finally settled on the desired behaviors for all cases of exponentiation involving infinities, but to close out the related issues in mathjs it would be very helpful if these could be nailed down.
Also, not to throw a wrench into these works, but it seems to me that these functions need to deal with three different infinities:
A) The JavaScript number Infinity, which I think of as "real positive infinity," or in the context of the complex numbers, "infinity in the direction 1+0i." Further, I would propose that the guiding principle for determining what the desired value for some operation f(c, Infinity) should be is that it should equal the limit as real x approaches ∞ of f(c, x), if that exists, or NaN otherwise.
B) The JavaScript number -Infinity, which should be the same but in the other direction, presumably governed by f(c,-Infinity) equal to the limit as real x approaches -∞ of f(c,x) if that exists, or NaN otherwise.
C) The Complex entity Complex.INFINITY, which I gather from the discussions is taken to represent "infinity in any direction" or more precisely the point opposite 0 on the Riemann sphere. This is to be governed by arithmetic on the Riemann sphere, which (I think...) corresponds to f(c, Complex.INFINITY) should be the common limit as z grows in modulus without bound along any path, if such limits are all alike, and NaN otherwise. In practice, this rule means that many operations on Complex.INFINITY will be undefined (many more than on Infinity and -Infinity) because such limits can be very dependent on the particular path chosen.
The reason I think this is important is encapsulated by the example pow(-0.5, Infinity). Evaluated on the real numbers with javascript numbers or in mathjs with javascript numbers, this is Math.pow(-0.5, Infinity) = math.pow(-0.5, Infinity) = 0. Therefore, for Complex.js to be conservative for reals as javascript numbers embedded in the complex numbers, it should be the case that complex(-0.5, 0).pow(Infinity) equals 0, but it currently does not; it comes out as Complex.NAN. Since indeed, even for complex z = -0.5 + 0i, it is the case that for real x the limit as x goes to ∞ is 0, I think the current behavior is incorrect; I believe complex(-0.5, 0).pow(Infinity) should be 0, and complex(-0.5, 0).pow(Complex.INFINITY) should be Complex.NAN (since the limit certainly does not exist if the exponent is allowed to increase unboundedly in modulus along any path).
It would be really lovely to clear these issues off the mathjs and complex.js tables once and for all in a logically consistent manner, since they have been so long-standing. Any effort/attention the maintainers here can give the matter would be greatly appreciated, and I am happy to assist in any way I can -- please just ask.
The reason I think this is important is encapsulated by the example pow(-0.5, Infinity). Evaluated on the real numbers with javascript numbers or in mathjs with javascript numbers, this is Math.pow(-0.5, Infinity) = math.pow(-0.5, Infinity) = 0. Therefore, for Complex.js to be conservative for reals as javascript numbers embedded in the complex numbers, it should be the case that complex(-0.5, 0).pow(Infinity) equals 0, but it currently does not; it comes out as Complex.NAN. Since indeed, even for complex z = -0.5 + 0i, it is the case that for real x the limit as x goes to ∞ is 0, I think the current behavior is incorrect; I believe complex(-0.5, 0).pow(Infinity) should be 0, and complex(-0.5, 0).pow(Complex.INFINITY) should be Complex.NAN (since the limit certainly does not exist if the exponent is allowed to increase unboundedly in modulus along any path).
Perhaps an even simpler more dramatic example: pow(0.5, Infinity). If I understand correctly, that will now return Complex.NAN rather than 0, which seems rather shocking.
If I understand correctly, @gwhitney 's proposal is that Complex(0.5,0).pow(Infinity) should return 0, and Complex(0.5,0).pow(Complex.INFINITY) should return Complex.NAN. That sounds sensible to me.
(More generally, w^+-Infinity should be the familiar limit restricting the exponent's limit path to reals, which is well-defined for most w's; that is: w^Infinity=0 and w^-Infinity=Infinity for |w|<1, w^Infinity=Infinity and w^-Infinity=0 for |w|>1, 1^+-Infinity=1, w^+-Infinity=Complex.NAN for all other |w|=1. Hopefully I typed all that correctly.)
Activity
[-]Behaviour of `Complex(Infinity).exp()`?[/-][+]Behaviour of Complex(Infinity).exp()?[/+]derknorton commentedon Mar 9, 2018
harrysarson commentedon Mar 9, 2018
What does that make
Complex(Infinity).exp()equal to?derknorton commentedon Mar 9, 2018
balagge commentedon Mar 9, 2018
indeterminate. (no value, NaN, whatever. same as 0 / 0)
balagge commentedon Mar 9, 2018
wolfram:

balagge commentedon Mar 9, 2018
This is because

which means that if z = x + iy and z goes to infinity, then we cannot determine the limit of exp(z). For example, take the following z values: 0, i, 2i, 3i, .... Then the limit exp(0), exp(i), exp(2i), ... will be meaningless, as exp(n i) = cos n + i sin n, which is essentially a "random" point on the unit circle, clearly does not converge (neither to infinity, nor to any given complex number)
balagge commentedon Mar 9, 2018
or, if you take the z values: 0, i*pi, 2 i*pi, 3 i*pi, etc. (clearly z goes to infinity) then the exp(z) values will be +1, -1, +1, ... as exp(n i pi) is -1 if n is odd and + 1 if n is even.
complex exponentiation is always tricky.
balagge commentedon Mar 9, 2018
truly confusing, I never liked this part of complex theory.
https://en.wikipedia.org/wiki/Exponential_function#Complex_plane
balagge commentedon Mar 9, 2018
this is how wikipedia pictures the complex exp function. pretty cool. Brightness means the absolute value, color means the direction.
Now if you approach infinity "to the right", then you will have a sequence that also goes to infinity. However, if you approach it "to the top" (as in the example I wrote above), then you will be going around the unit circle. Same with the bottom direction.
If you go left (to the same complex infinity) than the exponentiation will go to zero...
https://upload.wikimedia.org/wikipedia/commons/a/a7/Complex_exp.jpg
derknorton commentedon Mar 9, 2018
harrysarson commentedon Mar 9, 2018
@derknorton Both cases are relivant but to clarify:
Complex(Infinity).exp()calculatese^Infinityso I was talking about the second case.derknorton commentedon Mar 9, 2018
harrysarson commentedon Mar 9, 2018
To summarise for complex
z:0 ^ Infinity === 01 ^ Infinity === 1z ^ Infinity === |z| < 1 ? 0 : NaNInfinity ^ Infinity === NaNInfinity ^ 0 === NaNInfinity ^ 1 === InfinityInfinity ^ z === Infinitymaybe?
derknorton commentedon Mar 9, 2018
4 remaining items
balagge commentedon Mar 9, 2018
1 ^ Infinityis indeterminate. This I do not understand as of yet. Still working on it.balagge commentedon Mar 9, 2018
z ^ Infinityis indeterminate, even if|z| < 1. This would require determining a definite limit forz ^ w(wherew -> Infinity). However, unlesszis a positive real number, such powers are difficult to calculate and some (most) do not even have a single well-defined value, but many different (sometimes infinitely many different) possible results. As I have said before, exponentiation on the complex plane is hard and counter-intuitive.Quote from wikipedia:
"Trying to extend these functions to the general case of noninteger powers of complex numbers that are not positive reals leads to difficulties. Either we define discontinuous functions or multivalued functions. Neither of these options is entirely satisfactory."
In other words,
z ^ wis better left undefined, unlesszis a positive real.This means that the infinite case,
z ^ Infinityshould, in my opinion, be indeterminate for the general case (zis not a positive real).However, for the positive real case: this is also indeterminate, unless
z = 1, which is the case above, and I am not sure about it. This case is basically very similar toe ^ Infinity, because a powera ^ wcan be solved by writinga ^ w = e ^ (ln(a) w ). Then decomposew = x + i y, you gete ^ (ln(a) * (x + i y)), which ise ^ (ln(a) x + i ln(a) y) = a ^ x * (cos (ln(a) y) + i sin (ln(a) y). This is a bit of a mess at first sight, but it is essentially the same as the natural base case mentioned earlier, unlessa = 1. Fora <> 1, you can always choose some sillyw's, so that e.g. the real part ofw(which isx) is fixed, and then you get "random" numbers on the circle with radius a^x, clearly divergent.balagge commentedon Mar 9, 2018
Infinity ^ Infinity === NaNthat is correct.Infinity ^ 0 === NaNInfinity ^ 1 === Infinitythat is correct by definition.Infinity ^ zis, unfortunately, again indeterminate, unlesszis a non-zero real number. However, for reals, this may have a value:Infinity ^ xisInfinity, ifxis positive,0ifxis negative. I am a bit tired to be 100% sure, but this is what Wolfram gives as a result and it seems ok.balagge commentedon Mar 9, 2018
Summary:
Any exponentiation involving Infinity (either as base or exponent) is indeterminate, except:
(6)
Infinity ^ 1 === Infinity,(7a)
Infinity ^ z === Infinity, ifzis a positive real number (Im(z) === 0, Re(z) >0)(7b)
Infinity ^ z === 0, ifzis a negative real number (Im(z) === 0, Re(z) < 0)And, the only question is the result of
1 ^ Infinity, but I need some more time on that one. (but wolfram gives indeterminate for that as well)harrysarson commentedon Mar 14, 2018
For (7b) could we qnot have
.
Infinity ^ z === 0if the real part ofzis negative. Wolfram agrees:I can buy that (1), (3) and (4) should all be
NaN.As for
1 ^ Infinity, could this not be1? The best argument that I can think of against this is that it isz ^ InfinityisNaNfor allz !== 1so it might as well beNaNfor1aswell.[-]Behaviour of Complex(Infinity).exp()?[/-][+]Behaviour of z^Infinity and Infinity^z[/+]harrysarson commentedon Mar 14, 2018
To summarise for any complex
z:z ^ Infinity === NaNInfinity ^ z === InfinityifIm(z) === 0andRe(z) > 0Infinity ^ z === 0ifRe(z) < 0Infinity ^ 0 === 1Infinity ^ z === NaNotherwiseQuestion: should
Infinity ^ 0 === 1which would fit with behavour for Numbers in js?derknorton commentedon Mar 15, 2018
harrysarson commentedon Mar 15, 2018
Modifies exp() and pow() and specs behaviour of z^inf and inf^z.
balagge commentedon Mar 21, 2018
@harrysarson
you are right, provided that exponentiation is otherwise defined with a fixed branch cut of the
log()function.Wikipedia has a good explanation on how to compute a complex power:
https://en.wikipedia.org/wiki/Exponentiation#Computing_complex_powers
So if we want to compute
w^z, we must choose a branch cut oflog(), normally(-pi, pi]Then
wmust be written in polar decompositionw = r e^(i theta)(choosingthetaso thatpi < theta <= pi, the principal branch cut), and z in Cartesian decompositionz = c + d i). The following formula gives the result:w^z = r^c e^(-d theta) (cos(d log(r) + c theta) + i sin (d log(r) + c theta))This indeed converges if
Re(z) = c < 0(w -> Infinity) , because ther^cpart will converge to0, thee^(-d theta)part is within a fixed range (here we use heavily thatthetais in a fixed finite interval), and the rest is just a point on the unit circle, again bounded.Generally, with multi-valued powers, this does not work, because
thetacan have any value and might "work against" ther^cpart, hence no convergence.Bottom line: if Complex.js defines
z^wusing this approach of a fixed branch cut, thenInfinity^z = 0ifRe(z) < 0. You are right, I was wrong. :)balagge commentedon Mar 21, 2018
For
Infinity ^ 0all material that I can find says it is indeterminate (even with real infinity)https://en.wikipedia.org/wiki/Indeterminate_form
Infinity ^ 0cannot be computed withlim z^0 (z -> Infinity). (That approach would yieldInfinity * 0 = 0as well, clearly wrong, azInfinity * 0is also indeterminate)The right way is with
lim z^w (z -> Infinity, w -> 0). And that does not converge generally.balagge commentedon Mar 21, 2018
Funny that javascript has
Math.pow(Infinity,0) === 1. Yeah, that is a problem. But javascript also hasMath.pow(-2, Infinity) === Infinity, which is even more silly. I do not know where they got that idea ...gwhitney commentedon Oct 31, 2026
It's not 100% clear to me whether this conversation finally settled on the desired behaviors for all cases of exponentiation involving infinities, but to close out the related issues in mathjs it would be very helpful if these could be nailed down.
Also, not to throw a wrench into these works, but it seems to me that these functions need to deal with three different infinities:
A) The JavaScript number Infinity, which I think of as "real positive infinity," or in the context of the complex numbers, "infinity in the direction 1+0i." Further, I would propose that the guiding principle for determining what the desired value for some operation f(c, Infinity) should be is that it should equal the limit as real x approaches ∞ of f(c, x), if that exists, or NaN otherwise.
B) The JavaScript number -Infinity, which should be the same but in the other direction, presumably governed by f(c,-Infinity) equal to the limit as real x approaches -∞ of f(c,x) if that exists, or NaN otherwise.
C) The Complex entity Complex.INFINITY, which I gather from the discussions is taken to represent "infinity in any direction" or more precisely the point opposite 0 on the Riemann sphere. This is to be governed by arithmetic on the Riemann sphere, which (I think...) corresponds to f(c, Complex.INFINITY) should be the common limit as z grows in modulus without bound along any path, if such limits are all alike, and NaN otherwise. In practice, this rule means that many operations on Complex.INFINITY will be undefined (many more than on Infinity and -Infinity) because such limits can be very dependent on the particular path chosen.
The reason I think this is important is encapsulated by the example pow(-0.5, Infinity). Evaluated on the real numbers with javascript numbers or in mathjs with javascript numbers, this is Math.pow(-0.5, Infinity) = math.pow(-0.5, Infinity) = 0. Therefore, for Complex.js to be conservative for reals as javascript numbers embedded in the complex numbers, it should be the case that complex(-0.5, 0).pow(Infinity) equals 0, but it currently does not; it comes out as Complex.NAN. Since indeed, even for complex z = -0.5 + 0i, it is the case that for real x the limit as x goes to ∞ is 0, I think the current behavior is incorrect; I believe complex(-0.5, 0).pow(Infinity) should be 0, and complex(-0.5, 0).pow(Complex.INFINITY) should be Complex.NAN (since the limit certainly does not exist if the exponent is allowed to increase unboundedly in modulus along any path).
It would be really lovely to clear these issues off the mathjs and complex.js tables once and for all in a logically consistent manner, since they have been so long-standing. Any effort/attention the maintainers here can give the matter would be greatly appreciated, and I am happy to assist in any way I can -- please just ask.
donhatch commentedon Nov 4, 2026
@gwhitney wrote:
Perhaps an even simpler more dramatic example:
pow(0.5, Infinity). If I understand correctly, that will now return Complex.NAN rather than 0, which seems rather shocking.If I understand correctly, @gwhitney 's proposal is that Complex(0.5,0).pow(Infinity) should return 0, and Complex(0.5,0).pow(Complex.INFINITY) should return Complex.NAN. That sounds sensible to me.
(More generally, w^+-Infinity should be the familiar limit restricting the exponent's limit path to reals, which is well-defined for most w's; that is: w^Infinity=0 and w^-Infinity=Infinity for |w|<1, w^Infinity=Infinity and w^-Infinity=0 for |w|>1, 1^+-Infinity=1, w^+-Infinity=Complex.NAN for all other |w|=1. Hopefully I typed all that correctly.)