Why is cexp (+ infinity + i * infinity) = +/- infinity + i * NaN in C?

If we look at the project of the C langage: n1570 project and especially to Annex G concerning the behavior of complex mathematical functions, we see that the complex exponent has the following behavior at infinity:

 cexp(+infinity+I*infinity)=+/-infinity+I*NaN (where the sign of the real part of the result is unspecified). 

My question is why?

From a mathematical point of view, if you approach the infinity of the real and imaginary parts in the same way, the limit is complex infinity (see Wolfram Alpha ), which corresponds to the infinite modulus and the argument undefined.

Moreover, if we look at the behavior of the cexp function, it is quite comparable for its real and imaginary parts (see 3D-graphics on Wolfram Alpha ).

So, I would expect:

 cexp(+infinity+I*infinity)=+/-infinity+/-I*infinity 

instead:

 cexp(+infinity+I*infinity)=+/-infinity+I*NaN 

I know there is a great reason for this, but I do not understand this. Can someone explain the logic of this to me?

EDIT: here is a short description of the links:

Summary

+6
source share
2 answers

The motivation is indeed given in a njuffa-related document, http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf :

7.3.9.4 cproj function

In complex mathematics, two topologies are usually used: a complex with a plane with a continuum of infinities and a Riemann sphere with its only infinity. The complex plane is better suited for transcendental functions, the Riemann sphere for algebraic functions. Complex types with their multiplicity of infinities provide a useful (albeit imperfect) model for the complex plane. The cproj function helps to model the Riemann sphere by mapping all infinities into one, and it should be used immediately before any operation, especially comparisons that can give side results for any other infinities.

Note that a complex value with one infinite part and one part NaN is considered to be infinity, not NaN , because if one part is infinite, the complex value is infinite regardless of the value of the other part. For the same reason, a taxi returns infinity if its argument has an infinite part and a NaN part.

G.5.1 also has a similar remark:

... To support a model with one infinity, C99 treats any complex value with at least one infinite part as complex infinity (even if the other part is NaN) and ensures that operations and functions adhere to the basic properties of infinities and provides the cproj function to display all infinity into canonical ....

The corresponding search term was โ€œRiemann,โ€ as in the Riemann sphere, a mathematical model of an extended complex plane with one infinity, which is used in Mathematica / Wolfram Alpha, but not universally in mathematics.

+2
source

One of the reasons for NaN is that there is no idea of โ€‹โ€‹the โ€œdirectionโ€ that takes on this infinite meaning. With real numbers lim a->inf : exp(a) -> + infinity . Clearly defined directions give an intuitive sense of why:

1/(+0) = +inf , 1.0 / (-0.0) = -inf and:

1/(+inf) = +0 , 1/(-inf) = -0

Continuing this to the complex plane: cexp([-]inf + bI) = [-]inf.{cos(b) + I.sin(b)}

Despite the fact that the result is infinite, the concept of direction still exists, for example, if b = - PI/2 โ†’ cexp(+inf + bI) = +inf.(-I)

If b = [-]inf , then the direction in which infinity approaches is uncertain. There are an infinite number of directions, and the values โ€‹โ€‹for cos(b) and sin(b) undefined. It is not surprising that the real functions cos[f|l] and sin[f|l] return a NaN if the argument is infinite.

This is not a very formal answer, I'm afraid - just "feel" the idea. I understand that there are other good reasons for this behavior, such as using branch cuts in complex analysis.

0
source

Source: https://habr.com/ru/post/948846/


All Articles