Re: [sage-support] Re: Generating variables using indexing

2013-04-02 Thread Gary McConnell
yes, thanks! On Sun, Mar 31, 2013 at 12:47 AM, Jason Grout wrote: > On 3/30/13 4:09 PM, Gary McConnell wrote: > >> So I understand something of what is going on, could you please tell me >> why the tuple thing is necessary for the "used" set but the vectors are >> necessary for the "bases": ie w

Re: [sage-support] Re: Generating variables using indexing

2013-04-01 Thread Gary McConnell
One other thought - if we do manage to get this search routine to work "sequentially" (ie not necessarily to have to hold all things in memory at the same time), then perhaps we can extend this philosophy right back to the definition of "N_1" (my candidate vectors with norm 1 etc), because once aga

Re: [sage-support] Re: Generating variables using indexing

2013-04-01 Thread Gary McConnell
Hi again well, not that I understand *how*, but that code works *magnificently*! I see (confusingly for me I am afraid :) ) that the concept of "reserved words" does not have much currency in SAGE ... ! The only difficulty with using that code is that for the sets I am looking at, the number of b

[sage-support] Re: Generating variables using indexing

2013-03-30 Thread Jason Grout
On 3/30/13 4:56 PM, Gary McConnell wrote: OK so thinking about it, even though your code is beautifully compact and elegant, I think I am going to have to revert a little to the "outer-inner-loop" structure in order to achieve what I need. Namely, instead of storing "used" vectors, I store "used"

[sage-support] Re: Generating variables using indexing

2013-03-30 Thread Jason Grout
On 3/30/13 4:09 PM, Gary McConnell wrote: So I understand something of what is going on, could you please tell me why the tuple thing is necessary for the "used" set but the vectors are necessary for the "bases": ie why can we not use a vector structure for "used"? The bases is just a list of l

Re: [sage-support] Re: Generating variables using indexing

2013-03-30 Thread Gary McConnell
OK so thinking about it, even though your code is beautifully compact and elegant, I think I am going to have to revert a little to the "outer-inner-loop" structure in order to achieve what I need. Namely, instead of storing "used" vectors, I store "used" bases and search through the remaining orth

Re: [sage-support] Re: Generating variables using indexing

2013-03-30 Thread Gary McConnell
Thanks again Jason - that seems to do the trick - now I just have to figure out the equivalent of the old BASIC "goto 10" to start your loop again!! So I understand something of what is going on, could you please tell me why the tuple thing is necessary for the "used" set but the vectors are neces

[sage-support] Re: Generating variables using indexing

2013-03-30 Thread Jason Grout
On 3/30/13 1:43 PM, Gary McConnell wrote: OK now I'm back in a familiar nightmare - if I set the vectors to be immutable then I cannot treat them as vectors because they seem to be of "NoneType" or something so have no length etc etc; however I cannot /not /set them to be immutable if I wish to w

Re: [sage-support] Re: Generating variables using indexing

2013-03-30 Thread Gary McConnell
OK now I'm back in a familiar nightmare - if I set the vectors to be immutable then I cannot treat them as vectors because they seem to be of "NoneType" or something so have no length etc etc; however I cannot *not *set them to be immutable if I wish to work through a list consisting of those very

Re: [sage-support] Re: Generating variables using indexing

2013-03-30 Thread Gary McConnell
Brilliant - thanks Jason - sorry for delay On Sat, Mar 30, 2013 at 2:04 PM, Jason Grout wrote: > On 3/30/13 8:39 AM, Gary McConnell wrote: > >> One more thing Jason: the code you wrote, as far as I can see, does not >> take account of "N", which I guess is your N=set(N1) of my "N1" - the >> poin

[sage-support] Re: Generating variables using indexing

2013-03-30 Thread Jason Grout
On 3/30/13 8:39 AM, Gary McConnell wrote: One more thing Jason: the code you wrote, as far as I can see, does not take account of "N", which I guess is your N=set(N1) of my "N1" - the point is I guess that if I pass N1 to the function instead of your F then it should be ok (ie it only searches wi

Re: [sage-support] Re: Generating variables using indexing

2013-03-30 Thread Gary McConnell
One more thing Jason: the code you wrote, as far as I can see, does not take account of "N", which I guess is your N=set(N1) of my "N1" - the point is I guess that if I pass N1 to the function instead of your F then it should be ok (ie it only searches within the subset N1 of the full vector space)

Re: [sage-support] Re: Generating variables using indexing

2013-03-30 Thread Gary McConnell
fair enough - I'm not too clear myself on how to describe it sorry - but for example, if you look at the code I posted in the .txt file, ideally the vv_i,ww_i,xx_i,yy_i etc would be variables which would only be created if the requisite antecedent vectors had been found (as effectively happens in

Re: [sage-support] Re: Generating variables using indexing

2013-03-30 Thread Gary McConnell
yes indeed that is a problem in the general case but in fact in my experience with the particular things I am looking at is that either the first such set works, or else none of them do so it may not be as much of a problem in this case. Fingers crossed! On Sat, Mar 30, 2013 at 1:09 PM, Jaso

[sage-support] Re: Generating variables using indexing

2013-03-30 Thread Jason Grout
On 3/30/13 7:58 AM, Gary McConnell wrote: Am I to deduce from this that what I was originally trying to do (ie telescoping recursive variables) is not possible in Python? Sorry---it wasn't ever really clear to me how you were approaching the problem and what you meant by "telescoping recursive

[sage-support] Re: Generating variables using indexing

2013-03-30 Thread Jason Grout
On 3/30/13 7:49 AM, Gary McConnell wrote: in fact the construction of N1 precludes isotropic vectors - I should have mentioned that. The xRy function effectively forces separate sets of vectors to be mutually exclusive also. I have learnt a lot from your example there - but unfortunately I cannot

Re: [sage-support] Re: Generating variables using indexing

2013-03-30 Thread Gary McConnell
Hi again - thanks for that excellent new function - it's amazingly compact and I think it may well do what I need - I am about to try modifying it to work in my context, and will let you know. Am I to deduce from this that what I was originally trying to do (ie telescoping recursive variables) is

Re: [sage-support] Re: Generating variables using indexing

2013-03-30 Thread Gary McConnell
Hi in fact the construction of N1 precludes isotropic vectors - I should have mentioned that. The xRy function effectively forces separate sets of vectors to be mutually exclusive also. I have learnt a lot from your example there - but unfortunately I cannot get to where I need to - I have just rec

[sage-support] Re: Generating variables using indexing

2013-03-30 Thread Jason Grout
On 3/30/13 7:12 AM, Jason Grout wrote: So to summarize your code, you're finding M=3 sets of d=3 mutually orthogonal vectors so that each pair of sets satisfies some criteria (your XRY function)? Do the sets have to be mutually exclusive? Your code doesn't enforce this, but your xRy function may

[sage-support] Re: Generating variables using indexing

2013-03-30 Thread Jason Grout
On 3/30/13 6:34 AM, Gary McConnell wrote: Hi Jason - thanks a lot - I have attached a text file which is just a cleaned-up version of my code, with some explanations at the top for functions whose details are not relevant to the question. Apologies - you'll see it's a "neat mess", so to speak ...

Re: [sage-support] Re: Generating variables using indexing

2013-03-30 Thread Gary McConnell
Hi Jason - thanks a lot - I have attached a text file which is just a cleaned-up version of my code, with some explanations at the top for functions whose details are not relevant to the question. Apologies - you'll see it's a "neat mess", so to speak Kind regards Gary On Sat, Mar 30, 2013

[sage-support] Re: Generating variables using indexing

2013-03-30 Thread Jason Grout
On 3/30/13 5:08 AM, Gary McConnell wrote: Hi Jason fair question - I was trying to avoid including all the boring details of my code! In the simplest case I have a search routine which looks for M sets of d vectors inside a vector space of dimension N over a finite field, whose dot products sati

Re: [sage-support] Re: Generating variables using indexing

2013-03-30 Thread Gary McConnell
Hi Jason fair question - I was trying to avoid including all the boring details of my code! In the simplest case I have a search routine which looks for M sets of d vectors inside a vector space of dimension N over a finite field, whose dot products satisfy a bunch of polynomial equations. My prob

[sage-support] Re: Generating variables using indexing

2013-03-30 Thread Jason Grout
On 3/29/13 6:38 PM, GaryMak wrote: d = 5; for ii in range(0,d): for a[ii] in range(0,d): print a[ii]^2 + ii; What do you expect the output of this to be? What are you trying to accomplish with this code? Thanks, Jason -- You received this message because you are subscribed

Re: [sage-support] Re: Generating variables using indexing

2013-03-30 Thread Gary McConnell
I guess that's what I don't understand then: why can I not invoke a structure like this? In fact I need to nest several levels of this type of structure, so I would then define variables b_xx etc as b[a[ii]] and so on. If that is not how these variable definitions work, could someone please tell me

Re: [sage-support] Re: Generating variables using indexing

2013-03-29 Thread Tom Boothby
oops, didn't read carefully enough... that third line just doesn't make much sense. On Fri, Mar 29, 2013 at 4:49 PM, Tom Boothby wrote: > Gary, > > The third line > > for a[ii] in range(0,d): > > should read > > for ii in range(0,d): > > On Fri, Mar 29, 2013 at 4:38 PM, GaryMak wrote: >> Hi guys

Re: [sage-support] Re: Generating variables using indexing

2013-03-29 Thread Tom Boothby
Gary, The third line for a[ii] in range(0,d): should read for ii in range(0,d): On Fri, Mar 29, 2013 at 4:38 PM, GaryMak wrote: > Hi guys > > apologies as usual for how dumb this question's going to sound ... but how > do I actually use the variables a[1] etc? What I was hoping to do was to u

[sage-support] Re: Generating variables using indexing

2013-03-29 Thread GaryMak
Hi guys apologies as usual for how dumb this question's going to sound ... but how do I actually *use *the variables a[1] etc? What I was hoping to do was to use them in the following way (once I had already apparently successfully invoked Jason's routine), where d is a variable I would like to

[sage-support] Re: Generating variables using indexing

2011-07-05 Thread kcrisman
On Jul 4, 8:05 pm, Jason Grout wrote: > This question has come up often enough that I thought posting a short > snippet here might be useful.  The question is: how do I automatically > generate variables based on indices (e.g., a[0], a[1], etc. being > variables).  Here is one way: > > class Var