diff --git a/Project.toml b/Project.toml index 4c9504d6a..9c96cc751 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 54c187c92..5787f380c 100644 --- a/src/diff.jl +++ b/src/diff.jl @@ -138,12 +138,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) @@ -152,7 +152,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) @@ -326,7 +326,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