From 6db5362ecfb3dee872d679e4ebf20c8bb608e7d9 Mon Sep 17 00:00:00 2001 From: Alexey Stukalov Date: Fri, 19 Nov 2021 15:58:24 +0100 Subject: [PATCH 1/2] add exp(-1) constant useful in many situations, also -exp(-1) is the branching point of Lambert's W_0(t) and W_{-1}(t) --- src/IrrationalConstants.jl | 3 ++- src/stats.jl | 2 ++ test/runtests.jl | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/IrrationalConstants.jl b/src/IrrationalConstants.jl index e9c2b27..54263e0 100644 --- a/src/IrrationalConstants.jl +++ b/src/IrrationalConstants.jl @@ -26,7 +26,8 @@ export logten, # log(10) logπ, # log(π) log2π, # log(2π) - log4π # log(4π) + log4π, # log(4π) + invℯ # 1 / ℯ include("stats.jl") diff --git a/src/stats.jl b/src/stats.jl index c221961..389dc50 100644 --- a/src/stats.jl +++ b/src/stats.jl @@ -28,3 +28,5 @@ @irrational logπ 1.1447298858494001741 log(big(π)) @irrational log2π 1.8378770664093454836 log(2 * big(π)) @irrational log4π 2.5310242469692907930 log(4 * big(π)) + +@irrational invℯ 0.367879441171442321595 inv(big(ℯ)) diff --git a/test/runtests.jl b/test/runtests.jl index 0bab199..554ec86 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -40,3 +40,6 @@ end @test isapprox(log(4pi), log4π) end +@testset "1/e" begin + @test isapprox(invℯ, exp(-1)) +end From 4514543e7194cca8f9456009eeed33638771d424 Mon Sep 17 00:00:00 2001 From: Alexey Stukalov Date: Thu, 30 Dec 2021 22:39:34 +0100 Subject: [PATCH 2/2] add ASCII inve alias --- src/IrrationalConstants.jl | 2 +- src/stats.jl | 1 + test/runtests.jl | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/IrrationalConstants.jl b/src/IrrationalConstants.jl index 54263e0..c61978f 100644 --- a/src/IrrationalConstants.jl +++ b/src/IrrationalConstants.jl @@ -27,7 +27,7 @@ export logπ, # log(π) log2π, # log(2π) log4π, # log(4π) - invℯ # 1 / ℯ + invℯ, inve # 1 / ℯ include("stats.jl") diff --git a/src/stats.jl b/src/stats.jl index 389dc50..ce1dacc 100644 --- a/src/stats.jl +++ b/src/stats.jl @@ -30,3 +30,4 @@ @irrational log4π 2.5310242469692907930 log(4 * big(π)) @irrational invℯ 0.367879441171442321595 inv(big(ℯ)) +const inve = invℯ # ASCII alias diff --git a/test/runtests.jl b/test/runtests.jl index 554ec86..0ac1257 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -42,4 +42,5 @@ end @testset "1/e" begin @test isapprox(invℯ, exp(-1)) + @test isapprox(inve, exp(-1)) end