RiemannSphereOperations
Maths
This package provides some operations on the Riemann sphere $\hat{\mathbb{C}} = \mathbb{C} \cup \{\infty\}$.
The following are the calculation rules with the point at infinity $\infty$.
- $a + \infty = \infty \quad (a\in\mathbb{C})$
- $a \cdot \infty = \infty \quad (a\in\mathbb{C}\setminus\{0\})$
- $\infty \cdot \infty = \infty$
- $1/0 = \infty$
- $1/\infty = 0$
Note that the following cannot be defined.
- $0 / 0$
- $0 \cdot \infty$
- $\infty / \infty$
- $\infty + \infty$
- $\infty - \infty$
Package implementation
In this package, a value z which satisfies isinf(z) and !isnan(z) is used to represent the infinity $\infty$. Thus, all of complex(Inf,2.0), complex(Inf,-Inf), complex(1//0,1//1) are treated as the same point $\infty$ in this package.
All of the exported functions from this package has ′ (\prime<tab>) suffix which represents a modified version of the function on the Riemann sphere.
julia> using RiemannSphereOperationsjulia> inv(complex(0,0)) # 1/0 should be ∞NaN + NaN*imjulia> inv′(complex(0,0)) # correct 😎Inf - Inf*imjulia> complex(1) * Complex(Inf,-Inf) # 1⋅∞ should be ∞NaN + NaN*imjulia> complex(1) *′ Complex(Inf,-Inf) # correct 😎Inf - Inf*imjulia> Inf + Inf # ∞+∞ cannot be definedInfjulia> Inf +′ Inf # correct 😎NaN
This package has more functions such as isinfty′, +′, /′ etc. See the documentation page for more information.
Related information
- My post on Julia discourse
- This explains why I made this package.
- RiemannComplexNumbers.jl
- This package has the same motivation, but its implementation is different.
- RiemannComplexNumbers.jl defines original type
RC <: Numberwhich is used for the complex numbers on the Riemann sphere.
- Original issue on
inv(0+0im)- This issue explains why
inv(0+0im)should returnNaN + NaN*im
- This issue explains why
- Related issue on
NaNvsDomainError- This related issue is still open.