Jean Vittor wrote:
> Hi,
>
> I'm new to maxima and I have a hard time understanding how
> simplification works.
>
> My point is to use "sign" values (I mean integers which take their value
> from {-1;1}) and to be able to automate some trigo simplifications like
> (in the following, e is a sign and x a real expression):
> - sin(e*x) -> e*sin(x)
> - cos(e*x) -> cos(x)
> - cos(x+(1-e)*%pi/2) -> e*cos(x)
> - ...
> - and, of course, e^2 -> 1
>
> Is there a way to do this with maxima ?
If I've understood your question correctly, yes, there is a way to do
that using subst and ratsimp. For example:
f(x):=cos(x+(1-e)*%pi/2);
ratsimp(subst(-1,e,%));
gives f(x) := - cos(x)
If you want, you can also create both possibilities simultaneously like so:
[ratsimp(subst(+1,e,f(x))), ratsimp(subst(-1,e,f(x)))]
Ed