Maxima: Trigonometric simplification.



26 October 2007

Hi Stavro,

Thanks for the fast response and useful suggestions.

Regarding your comment on combinatorial search, etc I have a
rough idea for the simple case of an expression with 3 terms 

s = t1 + t2 + t3

as follows:

First compute the lists of indices of all the combinations of
pairs of terms

L1 = [[1,2],[3]]
L2 = [[2,3],[1]]
L3 = [[1,3],[2]]

Second apply some basic transformation/simplification function say
simp() to each pair of terms with indices in the lists L1,L2,L3:

sq1 = simp(part(s,L1[1])) + simp(part(s,L1[2])),
sq2 = ....
sq3 = ....

However it is not clear to me how to implement this idea in Maxima for the 
general case of an expression with N terms.

Any assistance would be appreciated.

TIA

C. Frangos.


On Thursday 25 October 2007 16:35, you wrote:
> There is no standard function, and as far as I know, no share function,
> which does exactly what you want. In particular, the scanmap function
> (which is what I think you're thinking of) does one pass over the tree,
> without searching among partitions of nodes -- that is, scanmap(q,a+b+c)) =
> q(q(a)+q(b)+q(c)); q never sees the partition a+b.
>
> However, it is easy enough to write it yourself, especially if you don't
> care about efficiency :-) . However, I don't think it's guaranteed that if
> you have a1+...+an and ai+aj => simpx(ai+aj) is a size-reducing
> transformation, that an arbitrary sequence of simpx's will get you to the
> smallest global result. You might have to do a combinatorial search....
>
> The base transformation you want is, I think, performed by trigrat, which I
> suppose you've experimented with?
>
>          -s