diff --git a/Project.toml b/Project.toml index 3acb45616..26aee1ec5 100644 --- a/Project.toml +++ b/Project.toml @@ -36,7 +36,7 @@ TreeViews = "a2a6695c-b41b-5b7d-aed9-dbfdeacea5d7" ArrayInterfaceCore = "0.1.1" ConstructionBase = "1.1, 1.2" DataStructures = "0.18" -DiffRules = "0.1, 1.0" +DiffRules = "1.4" Distributions = "0.23, 0.24, 0.25" DocStringExtensions = "0.7, 0.8, 0.9" DomainSets = "0.5" diff --git a/src/diff.jl b/src/diff.jl index 4540e137b..17f7cb5fb 100644 --- a/src/diff.jl +++ b/src/diff.jl @@ -144,12 +144,12 @@ end $(SIGNATURES) TODO - + # Examples ```jldoctest -julia> @variables x y z k; - +julia> @variables x y z k; + julia> f=k*(abs(x-y)/y-z)^2 k*((abs(x - y) / y - z)^2) @@ -158,7 +158,7 @@ julia> Dx=Differential(x) # Differentiate wrt x julia> dfx=expand_derivatives(Dx(f)) (k*((2abs(x - y)) / y - 2z)*IfElse.ifelse(signbit(x - y), -1, 1)) / y -``` +``` """ function expand_derivatives(O::Symbolic, simplify=false; occurances=nothing) if istree(O) && isa(operation(O), Differential) @@ -332,7 +332,7 @@ derivative(f, args, v) = NoDeriv() # Pre-defined derivatives import DiffRules -for (modu, fun, arity) ∈ DiffRules.diffrules() +for (modu, fun, arity) ∈ DiffRules.diffrules(; filter_modules=(:Base, :SpecialFunctions, :NaNMath)) fun in [:*, :+, :abs, :mod, :rem, :max, :min] && continue # special for i ∈ 1:arity