Maxima: Trigonometric simplification.



Thanks for the suggestion.

It seems that the function set_partitions() might be used as follows:

For the set A = {1,2,3....,n}, n>=3, let nx = n/2 if n is even and nx = 
floor(n/2) + 1 if n is odd. 

What seems to be needed is all the partitions of the set A where each 
partition consists of nx sets. If nx is even then each of these sets must 
have two elements. 

If nx is odd then (nx-1) of these sets must have two elements and the last 
set will have one element.

Now set_partitions(A,nx) generates the above, but also many other partitions 
not satisfying the above. Its not clear how to get rid of these unwanted 
partitions.

For example: 

(%i167) set_partitions(set(1,2,3,4),2);

(%o167) {{{1},{2,3,4}},{{1,2},{3,4}},{{1,2,3},{4}},{{1,2,4},{3}},
         {{1,3},{2,4}},{{1,3,4},{2}},{{1,4},{2,3}}}
(%i168) 

Any assistance would be appreciated.

TIA,

C. Frangos.


On Saturday 27 October 2007 15:34, you wrote:
> -----maxima-bounces at math.utexas.edu wrote: -----
>
> >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]]
>
> The function set_partitions might be helpful:
>
>   (%i17) set_partitions(set(1,2,3));
>   (%o17) {{{1},{2},{3}},{{1},{2,3}},{{1,2},{3}},{{1,2,3}},{{1,3},{2}}}
>
> BW