Issue with creating rule for even and odd function of cos and sin
yewalenikhil65 opened this issue · comments
using SymbolicUtils
@syms z
r = @acrule(cos(-1(~x)) => 1*cos(~x))
gives as expected
julia> r(cos(-z))
cos(z)
but for following, it doesn't work
julia> r(cos(-2z))
gives nothing
Can any one help me to generalise this rule ?
Why was this closed as completed?
As far as I can see, this is still not working and in particular one cannot use it to simplify expressions in Symbolics.jl.
julia> r = @acrule(cos(-1(~x)) => 1*cos(~x))
ACRule(cos(-1 * ~x) => 1 * cos(~x))
julia> simplify(cos(a) - cos(-a),rewriter = r)
cos(a) - cos(-a)
julia> r = @rule cos(-(~x)) => cos(~x)
cos(-(~x)) => cos(~x)
julia> simplify(cos(a) - cos(-a),rewriter = r)
cos(a) - cos(-a)
arguably, these properties should be included in the standard rules, or at least there should be some mention in the docs if it is not possible to make them work.
@NilsNiggemann I was told by Symbolics code maintainer to close it since it was answered to me on slack.. I will post details how i did it as soon as possible next week and try to make a PR out of this