JuliaSymbolics / Symbolics.jl

Symbolic programming for the next generation of numerical software
https://docs.sciml.ai/Symbolics/stable/
Other
1.37k stars 153 forks source link

Complex exponential registration #118

Open NilsKintscher opened 3 years ago

NilsKintscher commented 3 years ago

MWE:

julia> using Symbolics
julia> @syms x
julia> exp(im*Num(x))

ERROR: MethodError: no method matching decompose(::Num)
Closest candidates are:
  decompose(::BigFloat) at hashing2.jl:195
  decompose(::Float64) at hashing2.jl:184
  decompose(::Float32) at hashing2.jl:173
  ...
Stacktrace:
 [1] isfinite(::Num) at .\float.jl:556
 [2] exp(::Complex{Num}) at .\complex.jl:617
 [3] top-level scope at REPL[4]:1

┆Issue is synchronized with this Trello card by Unito

ChrisRackauckas commented 3 years ago

The "simple" solution is to just @register exp(x::Complex) and then define a derivative as the first tutorial shows. Though I think we will want to think about making the DiffRules parser somehow know what to do about the holomorphic functions. @YingboMa ?

YingboMa commented 3 years ago

We plan to make this work along with the array symbolics work.