Convert %union(...) to list



Even simpler:

maplist(first,soln)

By the way, using 'flatten' is generally a bad idea.  It will flatten
arbitrary numbers of levels, so flatten([a,[v1,v2]]) => [a,v1,v2], even if
[v1, v2] represents a vector.

           -s


On Tue, Apr 9, 2013 at 11:17 PM, Stavros Macrakis <macrakis at alum.mit.edu>wrote:

> apply('append,args(soln))
>
> But of course that assumes the result will always be in exactly that form.
> On Apr 9, 2013 9:47 PM, "Thomas D. Dean" <tomdean at speakeasy.org> wrote:
>
>> kill(all);
>> load(to_poly_solve);
>> declare(a,scalar);
>> assume(a>0);
>> eq1:h=sqrt(a^2-r^2)+a;
>> eq2:%pi*r^2*h/3;
>> define(f(r),subst(eq1,eq2));
>> define(df(r),diff(f(r),r,1));
>> define(ddf(r),diff(df(r),r,1))**;
>> soln:to_poly_solve(df(r)=0,r);
>> for s in soln do (
>>   if imagpart(first(s)) then (
>>     if ev(ddf(rhs(first(s))))<0 then (
>>       soln_r:s
>>       )
>>     )
>>   )$
>> print("Volume",f(rhs(first(**soln_r))))$
>>
>> soln is %union([r = 0],[r = -2^(3/2)*a/3],[r = 2^(3/2)*a/3])
>>
>> I want
>>
>> [r = 0,r = -2^(3/2)*a/3,r = 2^(3/2)*a/3]
>>
>> Is there an easier way than
>>
>> l:makelist();
>> for s in soln do l:[l,s];
>> l:flatten(l);
>>
>> Tom Dean
>> ______________________________**_________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/**mailman/listinfo/maxima<http://www.math.utexas.edu/mailman/listinfo/maxima>;
>>
>