Using Infinity in Julia
Overview
Infinities.jl
is a package that aids in using infinity symbols in Julia1. Surprisingly, infinity is quite useful in scientific computing coding.
Code
julia> 8 < Inf
true
The reason it’s mentioned that it helps in using infinity symbols, not just infinity, in the introduction is that you can actually use them without the package.
julia> using Infinities
julia> 8 < ∞
true
julia> -∞ < 8
true
julia> max(∞, 10, 11)
∞
julia> sin(∞)
ERROR: MethodError: no method matching AbstractFloat(::Infinities.Infinity)
As you can see, it possesses all the expected properties of infinity.
julia> ℵ₀ < ℵ₁
true
julia> ℵ₀ > ℵ₁
false
julia> ∞ == ℵ₁
false
julia> ∞ == ℵ₀
true
julia> ∞ === ℵ₀
false
Moreover, it allows the use of the cardinality of infinite sets with $\aleph_{0}$ and $\aleph_{1}$, which makes it possible to have the same infinity in terms of computation but still give them an order for sorting or comparison.
Environment
- OS: Windows
- julia: v1.6.2