diff --git a/Project.toml b/Project.toml index c007d0a..c7fa586 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "InverseFunctions" uuid = "3587e190-3f89-42d0-90ee-14403ec27112" -version = "0.1.13" +version = "0.1.14" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/src/inverse.jl b/src/inverse.jl index 3f5ccbf..99b4cdf 100644 --- a/src/inverse.jl +++ b/src/inverse.jl @@ -143,6 +143,18 @@ inverse(::typeof(log10)) = exp10 inverse(::typeof(expm1)) = log1p inverse(::typeof(log1p)) = expm1 + +inverse(::typeof(sinh)) = asinh +inverse(::typeof(tanh)) = atanh +inverse(::typeof(coth)) = acoth +inverse(::typeof(csch)) = acsch + +inverse(::typeof(asinh)) = sinh +inverse(::typeof(atanh)) = tanh +inverse(::typeof(acoth)) = coth +inverse(::typeof(acsch)) = csch + + inverse(::typeof(sqrt)) = square inverse(::typeof(square)) = sqrt diff --git a/test/test_inverse.jl b/test/test_inverse.jl index 5798127..7153ae8 100644 --- a/test/test_inverse.jl +++ b/test/test_inverse.jl @@ -54,6 +54,7 @@ end end for f in ( +, -, exp, exp2, exp10, expm1, cbrt, deg2rad, rad2deg, conj, + sinh, tanh, coth, csch, asinh, atanh, acsch, # all invertible hyperbolic functions aside from acoth Base.Fix1(+, rand()), Base.Fix2(+, rand()), Base.Fix1(-, rand()), Base.Fix2(-, rand()), Base.Fix1(*, rand()), Base.Fix2(*, rand()), Base.Fix1(/, rand()), Base.Fix2(/, rand()), Base.Fix1(\, rand()), Base.Fix2(\, rand()), Base.Fix2(^, rand(-11:2:11)), @@ -61,6 +62,10 @@ end InverseFunctions.test_inverse(f, x) InverseFunctions.test_inverse(f, -x) end + # acoth only defined for |x| > 1 + InverseFunctions.test_inverse(acoth, 1 + x) + InverseFunctions.test_inverse(acoth, -1 - x) + InverseFunctions.test_inverse(conj, 2 - 3im) InverseFunctions.test_inverse(reverse, [10, 20, 30])