You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
julia>using Symbolics
julia>using SymbolicUtils
julia>@syms x::Realf(::Real)::Number
(x, f)
julia> Symbolics.derivative(cos(f(x)), x) # so far so good-Differential(x)(f(x))*sin(f(x))
julia> Symbolics.derivative(conj(f(x)), x) # Symbolics doesn't know how to differentiate these,Differential(x)(conj(f(x)))*Differential(x)(f(x))
julia> Symbolics.derivative(imag(f(x)), x) # and it's so upsetDifferential(x)(imag(f(x)))*Differential(x)(f(x))
julia> Symbolics.derivative(real(f(x)), x) # it gets the chain rule wrongDifferential(x)(real(f(x)))*Differential(x)(f(x))
Btw, I am using Numberfor f here to represent a function that might be complex. Same thing happens for f(::Real)::Complex. I am not using Complex{Num} because I do not want to split real and imaginary parts.
The text was updated successfully, but these errors were encountered:
amilsted
changed the title
Chain rule fails on real, imag, conj, with Sym{Num}
Chain rule fails on real, imag, conj, with symbolic Number
Nov 14, 2023
Relatedly, it would be very nice if we could add rules for D(x)(conj(f(x))) -> conj(D(x)(f(x))) and similar for complex f but real x.
amilsted
changed the title
Chain rule fails on real, imag, conj, with symbolic Number
Chain rule fails on real, imag, conj, with non-real symbolic functions
Nov 14, 2023
Btw, I am using
Number
forf
here to represent a function that might be complex. Same thing happens forf(::Real)::Complex
. I am not usingComplex{Num}
because I do not want to split real and imaginary parts.The text was updated successfully, but these errors were encountered: