Skip to content

Commit

Permalink
derivative now throws for Function first input with non-Num second input
Browse files Browse the repository at this point in the history
  • Loading branch information
kapple19 committed Sep 3, 2024
1 parent b7d75d0 commit 4d74c67
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/diff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ derivative(::typeof(*), args::NTuple{N,Any}, ::Val{i}) where {N,i} = *(deleteat!
derivative(::typeof(one), args::Tuple{<:Any}, ::Val) = 0

derivative(f::Function, x::Num) = derivative(f(x), x)
derivative(::Function, x::Any) = TypeError(:derivative, "2nd argument", Num, typeof(x)) |> throw

function count_order(x)
@assert !(x isa Symbol) "The variable $x must have an order of differentiation that is greater or equal to 1!"
Expand Down

0 comments on commit 4d74c67

Please sign in to comment.