racket-cas icon indicating copy to clipboard operation
racket-cas copied to clipboard

trig pythagorean identity

Open zlee-personal opened this issue 7 years ago • 3 comments

Would it be possible to add a rule that cos^2(x) + sin^2(x) = 1?

zlee-personal avatar Jul 15 '17 19:07 zlee-personal

Yes. Suppose you have a polynomial expression P(X,Y) in X=cos(x) and Y=sin(x) then use polynomial-quotient-remainder to calculate P(X,Y) divided by X^2+Y^2. This gives:

P(X,Y) = Q(X,Y) (X^2+Y^2) + R(X,Y).

Now since X^2+Y^2 = 1 we have: P(X,Y) = Q(X,Y) + R(X,Y). So the reduced expression is Q(cos(x),sin(x)) + R(cos(x),sin(x))

I won't have time do this soon - but patches are welcome. FWIW I notice that the functionality is called trigsimp in Maxima.

soegaard avatar Jul 15 '17 19:07 soegaard

Looks like it is not easy for the polynomial-quotient-remainder approach to handle all the cases. we can have cos(x), but also cos(pi*x) cos(sqrt(x), so we cannot know what X and Y is in advance.

Instead, I think we can replace cos^2(...) with 1-sin^2(x) before trig-simplify, and recover it after trig-simplify.

BowenFu avatar Feb 10 '20 11:02 BowenFu

The function (variables u) can return a list of expressions in which u is a variable. I am thinking that a similar function could determine if an expression u has the form P(X,Y) where X=cos(v) and Y=sin(v).

soegaard avatar Feb 15 '20 11:02 soegaard