Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with creating rule for even and odd function of cos and sin #545

Closed
yewalenikhil65 opened this issue Aug 25, 2023 · 2 comments
Closed

Comments

@yewalenikhil65
Copy link

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 ?

@NilsNiggemann
Copy link

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.

@yewalenikhil65
Copy link
Author

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants