Gmail Calendar Documents Web Sites more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Maple: extracting data from sets of sets
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Roger Kopler  
View profile  
 More options Feb 27, 10:57 am
Newsgroups: comp.soft-sys.math.maple
From: "Roger Kopler" <ant...@spam.org>
Date: Sat, 27 Feb 2010 15:57:23 -0000
Local: Sat, Feb 27 2010 10:57 am
Subject: Maple: extracting data from sets of sets
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.


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Axel Vogt  
View profile  
 More options Feb 27, 11:12 am
Newsgroups: comp.soft-sys.math.maple
From: Axel Vogt <&nore...@axelvogt.de>
Date: Sat, 27 Feb 2010 17:12:48 +0100
Local: Sat, Feb 27 2010 11:12 am
Subject: Re: Maple: extracting data from sets of sets

   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)};


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roger Kopler  
View profile  
 More options Feb 27, 2:16 pm
Newsgroups: comp.soft-sys.math.maple
From: "Roger Kopler" <ant...@spam.org>
Date: Sat, 27 Feb 2010 19:16:05 -0000
Local: Sat, Feb 27 2010 2:16 pm
Subject: Re: Maple: extracting data from sets of sets
Thanks!!!

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

news:7usultFomkU1@mid.individual.net...


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Axel Vogt  
View profile  
 More options Feb 27, 3:53 pm
Newsgroups: comp.soft-sys.math.maple
From: Axel Vogt <&nore...@axelvogt.de>
Date: Sat, 27 Feb 2010 21:53:42 +0100
Local: Sat, Feb 27 2010 3:53 pm
Subject: Re: Maple: extracting data from sets of sets

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).

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ray Vickson  
View profile  
 More options Feb 27, 5:26 pm
Newsgroups: comp.soft-sys.math.maple
From: Ray Vickson <RGVick...@shaw.ca>
Date: Sat, 27 Feb 2010 14:26:00 -0800 (PST)
Subject: Re: Maple: extracting data from sets of sets
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},

        {a = 2, b = -4}, {b = 2, a = 0}, {a = 2, b = 0}]

[seq( eval(f(a,b),xi), xi in Y)]; <---------Note the '[ ]'
               1/2         1/2     1/2         1/2     1/2
       [3 - 3 2   , 2 + 2 2   , 3 2   , 2 - 4 2   , 2 2   , 2]

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:

{seq( eval(f(a,b),xi), xi in Y)}; <----- Note the '{ }'
                  1/2         1/2         1/2     1/2     1/2
       {2, 3 - 3 2   , 2 + 2 2   , 2 - 4 2   , 2 2   , 3 2   }

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.

R.G. Vickson.


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google