Skip to content

Commit

Permalink
Fix erf by adding IrrationalConstants
Browse files Browse the repository at this point in the history
  • Loading branch information
tansongchen committed Sep 27, 2023
1 parent 6b0b0e9 commit 449870d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "0.2.1"
ChainRules = "082447d4-558c-5d27-93f4-14fc19e9eca2"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
ChainRulesOverloadGeneration = "f51149dc-2911-5acf-81fc-2076a2a81d4f"
IrrationalConstants = "92d709cd-6900-40b7-9082-c6be49f344b6"
SliceMap = "82cb661a-3f19-5665-9e27-df437c7e54c8"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
SymbolicUtils = "d1185830-fcd6-423d-90d6-eec64667417b"
Expand All @@ -18,6 +19,7 @@ ChainRulesCore = "1"
ChainRulesOverloadGeneration = "0.1"
SliceMap = "0.2"
SpecialFunctions = "2"
IrrationalConstants = "0.2"
SymbolicUtils = "1"
Zygote = "0.6.55"
julia = "1.6"
3 changes: 2 additions & 1 deletion src/codegen.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using ChainRulesCore
using SpecialFunctions
using IrrationalConstants: sqrtπ
using SymbolicUtils, SymbolicUtils.Code
using SymbolicUtils: BasicSymbolic, Pow

Expand All @@ -26,7 +27,7 @@ using SymbolicUtils: BasicSymbolic, Pow
@scalar_rule asech(x::BasicSymbolic) inv(x * -sqrt(1 - x^2))
@scalar_rule asinh(x::BasicSymbolic) inv(sqrt(x^2 + 1))
@scalar_rule atanh(x::BasicSymbolic) inv(1 - x^2)
@scalar_rule erf(x::BasicSymbolic) exp(-x^2)*(2 / sqrt(pi))
@scalar_rule erf(x::BasicSymbolic) exp(-x^2) * 2/sqrtπ

dummy = (NoTangent(), 1)
@syms t₁
Expand Down

0 comments on commit 449870d

Please sign in to comment.