diff --git a/REQUIRE b/REQUIRE index d4e0ff34890cfa377997fe8d4a80ccfd8f5048a9..22417eb15471a191cb7bba97ba8262d0429250fa 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,5 +1,6 @@ -julia 0.6- +julia 1.0- Calculus NLsolve Suppressor BinaryProvider +SpecialFunctions \ No newline at end of file diff --git a/src/Utils.jl b/src/Utils.jl index 6fd7eff5316a3f97410331793983eed1a5404f6b..d2c9e6f2673704a80afcdd6acca908bfdcf86242 100644 --- a/src/Utils.jl +++ b/src/Utils.jl @@ -1,6 +1,6 @@ module Utils ## - # Copyright (C) 2015 Dynare Team + # Copyright © 2015-2019 Dynare Team # # This file is part of Dynare. # @@ -18,6 +18,10 @@ module Utils # along with Dynare. If not, see . ## +import Base: @irrational +@irrational sqrt2 1.4142135623730950488 sqrt(big(2.0)) +@irrational invsqrt2 0.7071067811865475244 inv(big(sqrt2)) + export get_power_deriv function get_power_deriv(x::Float64, p::Real, k::Int) @@ -33,4 +37,16 @@ function get_power_deriv(x::Float64, p::Real, k::Int) return dxp end + +using SpecialFunctions + +export normcdf + +normcdf(z::Number) = erfc(-z * invsqrt2)/2 + +function normcdf(x::Number, μ::Real, σ::Real) + z = (x - μ) / σ + normcdf(z) +end + end