racket-cas
racket-cas copied to clipboard
trig pythagorean identity
Would it be possible to add a rule that cos^2(x) + sin^2(x) = 1?
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.
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.
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)
.