Go to Google Groups Home    comp.soft-sys.math.maple
Re: Maple: extracting data from sets of sets

Roger Kopler <ant...@spam.org>

Thanks!!!

"Axel Vogt" <&nore...@axelvogt.de> wrote in message

news:7usultFomkU1@mid.individual.net...
> Roger Kopler wrote:
>> Hi,  I have a question about extracting data from a set to be used in a
>> function.  Suppose I have an object of the sort:

>> X:={{a=3,b=-3},{a=2,b=2},{a=0,b=3},{a=2,b=-4},{a=0,b=2},{a=2,b=0}};

>> and a function of the sort:

>> f:=(a,b)->a+b*sqrt(2);

>> How can I extract the values in the pairs (a,b) in X and use them in the
>> function f to create a set of 6 elements, i.e. {f(a,b) where {a,b} in X}
>> (and, no, I don't want to do this manually because I want to apply this
>> procedure, if it exists, to a set X containing a much larger number of
>> elements than 6)

>> Any help would be much appreciated.  Thanks in advance.

>   eval(f(a,b),op(1,X)); # uses the 1st equation in X

>                                    1/2
>                                 2 2

> and by running to all of them gives you all, for example

>   {seq( eval(f(a,b),op(j,X)), j=1 .. nops(X))};

> or

>   {seq( eval(f(a,b),xi), xi in X)};