# Inconsistency in derivative computation in Symbolics.jl

**URL:** <https://discourse.julialang.org/t/inconsistency-in-derivative-computation-in-symbolics-jl/91880>\
**Category:** General Usage\
**Tags:** differentiation, symbolics\
**Created:** [December 20, 2022, 12:04am UTC](https://discourse.julialang.org/t/inconsistency-in-derivative-computation-in-symbolics-jl/91880 "2022-12-20T00:04:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brianguenter](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brianguenter/32/29519_2.png) [@brianguenter](https://discourse.julialang.org/u/brianguenter)\
**Post date:** [December 20, 2022, 12:04am UTC](https://discourse.julialang.org/t/inconsistency-in-derivative-computation-in-symbolics-jl/91880/1 "2022-12-20T00:04:41Z")

</div>

These two ways of computing the derivative in Symbolics return the same result, as expected:

```julia
using Symbolics
@variables k1,k2

julia> Symbolics.derivative(^,(k1,k2),Val(1))
k2*(k1^(k2 - 1))

```

```julia
julia> Symbolics.derivative(k1^k2,k1)
k2*(k1^(k2 - 1))

```

But these two don’t:

```julia
julia> Symbolics.derivative(k1^k2,k2)
(k1^k2)*log(k1)

```

```julia
julia> Symbolics.derivative(^,(k1,k2),Val(2))
ERROR: TypeError: non-boolean (Num) used in boolean context
Stacktrace:
 [1] derivative(#unused#::typeof(^), args::Tuple{Num, Num}, #unused#::Val{2})
   @ Symbolics C:\Users\seatt\.julia\packages\Symbolics\FGTCH\src\diff.jl:344
 [2] top-level scope
   @ REPL[46]:1

```

Is this a bug?

> **installed packages**
>
> ```julia
> Status `C:\Users\seatt\source\Differentiation\Project.toml`
> [5ae59095] Colors v0.12.10
> [b552c78f] DiffRules v1.12.2
> [a2cc645c] GraphPlot v0.5.2
> [bd48cda9] GraphRecipes v0.5.12
> [f526b714] GraphViz v0.2.0
> [86223c79] Graphs v1.7.4
> [b964fa9f] LaTeXStrings v1.3.0
> [e9d8d322] Metatheory v1.3.5
> [91a5bcdd] Plots v1.38.0
> [6c8a4c8a] RelevanceStacktrace v0.1.8
> [c5292f4c] ResumableFunctions v0.6.1
> [295af30f] Revise v3.4.0
> [90137ffa] StaticArrays v1.5.11
> [d1185830] SymbolicUtils v0.19.11
> [0c5d862f] Symbolics v4.13.0
> ⌅ [8ea1fca8] TermInterface v0.2.3
> [f8b46487] TestItemRunner v0.2.1
> [1c621080] TestItems v0.1.0
> [b4f28e30] TikzGraphs v1.4.0
> [8dfed614] Test
> 
> ```

> **version info**
>
> ```julia
> julia> versioninfo()
> Julia Version 1.8.3
> Commit 0434deb161 (2022-11-14 20:14 UTC)
> Platform Info:
> OS: Windows (x86_64-w64-mingw32)
> CPU: 32 × AMD Ryzen 9 7950X 16-Core Processor
> WORD_SIZE: 64
> LIBM: libopenlibm
> LLVM: libLLVM-13.0.1 (ORCJIT, znver3)
> Threads: 32 on 32 virtual cores
> Environment:
> JULIA_EDITOR = code.cmd
> 
> ```

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 20, 2022, 7:43am UTC](https://discourse.julialang.org/t/inconsistency-in-derivative-computation-in-symbolics-jl/91880/2 "2022-12-20T07:43:03Z")

</div>

Yeah it looks like there’s a missing overload there. Please open an issue.
