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

Applying sin(-x)=-sin(x) with SymbolicUtils #683

Open
GamingValter14 opened this issue Dec 21, 2024 · 0 comments
Open

Applying sin(-x)=-sin(x) with SymbolicUtils #683

GamingValter14 opened this issue Dec 21, 2024 · 0 comments

Comments

@GamingValter14
Copy link

Hi, I am trying to simplify some trigonometric expressions using SymbolicUtils. After applying the product rules for sine and cosine terms, you can end up with negative arguments and I would like to implement the following rules for these:

sin(-x) = -sin(x) & cos(-x) = cos(x)

However, this works only in some cases because my trigonometric expressions have arguments of the type nwt where n can be any integer, together with a negative sign. Using the following code:

r8 = @acrule sin(~x)cos(~y) => 0.5(sin(~x + ~y) + sin(~x - ~y))
r12 = @rule sin(-1(~x)) => -1 * sin((~x))

expr20 = simplify(expand(Asin(2wt)cos(13wt)), RuleSet([r8, r12]))
println(expr20)
expr21 = simplify(expand(expr20), RuleSet([r12]))
println(expr21)

Returns the following:

0.5A(sin(-11tw) + sin(15tw))
0.5Asin(-11tw) + 0.5Asin(15tw)

As you can see, it does not catch the negative argument and I have tried a bunch of ways. Would anyone know how I could perform this simplification?

Thanks!

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

1 participant