# [Maxima] Simplification

Robert Dodier robert.dodier at gmail.com
Sun Feb 5 11:56:32 CST 2006

```Hello Devrim,

> I am new to maxima and managed to get a transformation matrix with
> trigonometric terms (sin,cos) symbolically computed.

> The resulting T matrix is however too huge.

Not sure what you mean here. If it is just clumsy, the
Maxima-to-Fortran business below should work OK.

> I need to get this transformation in a C application and so I would prefer
> to simplify it as much as possible. Would it reasable to expect Maxima to
> further simplify such a matrix ? If so, do you have any tips for me ?

? trig
at the input prompt lists several functions which can apply
trigonometric identities.

I find trigsimp applied to the expression you wrote yields
a slightly shorter expression in terms of sin^2 and cos^2.
That's not too helpful, I guess, since C doesn't have a
built-in integer exponent and it's not much shorter, anyway.

trigreduce yields a different but still messy expression.
trigsimp followed by trigreduce yields a mess too.
I didn't try anything else.

By the way, the fortran function prints a Maxima expression
as a Fortran statement, e.g.,

T : matrix ([a, b], [c, d]);
fortran (T);
=>
T(1,1) = a
T(1,2) = b
T(2,1) = c
T(2,2) = d

where a, b, c, d represent your trig expressions.
You could massage that into C, either by hand or
via the f2c program, or compile it with a Fortran