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.
> 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
>> 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
Be aware that if you are working with sets, there is no guarantee on ordering. So do not assume that positions match in the result and X (sets do not have an ordering, lists do).
On Feb 27, 12:53 pm, Axel Vogt <&nore...@axelvogt.de> wrote:
> Roger Kopler wrote: > > Thanks!!!
> Be aware that if you are working with sets, there > is no guarantee on ordering. So do not assume that > positions match in the result and X (sets do not > have an ordering, lists do).
However, you can give impose an ordering (but not controlled, initially); then that ordering remains in force throughout the rest of the session:
Y:=[seq(i,i in X)]; <----------- Note the '[ ]' Y := [{a = 3, b = -3}, {a = 2, b = 2}, {a = 0, b = 3},
Here, the ordering in Y is whatever ordering Maple decided to use for X when the call was made. You can't control it, but you can at least be guaranteed the order remains unchanged from now on (in Y, that is, not in X). If you don't use [ ] in this evaluation, Maple may again write the results in some random order:
So, here you don't know which element of Y gives the entry f(a,b) = 2!
Note: sets do not have repeated elements, so if you wanted to have two or more identical entries in X you could not do it: they would appear only once. Lists and sequences can, however, have repetitions.