-
Notifications
You must be signed in to change notification settings - Fork 122
Description
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!