Re: [Tutor] Finding the minimum value in a multidimensional array

2007-03-13 Thread Geoframer
ds Geofram On 3/13/07, Eike Welk <[EMAIL PROTECTED]> wrote: On Tuesday 13 March 2007 11:57, Geoframer wrote: > Hey everyone, > > I've been trying to locate a way to find the location of the > minimum value in an n*n array. The 'argmin' function is probably wh

[Tutor] Finding the minimum value in a multidimensional array

2007-03-13 Thread Geoframer
Hey everyone, I've been trying to locate a way to find the location of the minimum value in an n*n array. For instance suppose we have a 10x10 array. In [1]: import numpy In [2]: a = numpy.zeros((10,10)) In [3]: a Out[3]: array([[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], [ 0., 0.

Re: [Tutor] [Tutor} Why doesn't it choose a new number each time?

2007-02-15 Thread Geoframer
like so : print "AI chose %s, you chose %s. %s", %(values.get(cchoice),values.get (hchoice),combinations.get((cchoice,hchoice))) Probably this is not unlike Alan suggest, but i got confused when i read about tables. Unless he means dictionaries instead. HTH - Geoframer On 2/15/07, Rikard Bosnj

Re: [Tutor] 'elp!!!!!!!1Totally Clueless Newbie In Distress

2007-01-19 Thread Geoframer
urn 1 else: print "Porao inexistente!" if porao(): define() compativel() *** end inserted code *** HTH - Geoframer On 1/19/07, Geoframer <[EMAIL PROTECTED]> wrote: Accidentally the number of function definitions does not help the clarity of the program, even though it&

Re: [Tutor] 'elp!!!!!!!1Totally Clueless Newbie In Distress

2007-01-19 Thread Geoframer
112 comprimento = 211 return 1 elif porao == 4: altura_aeronave = 112 largura_aeronave = 113 comprimento = 212 return 1 else: print "Porao inexistente!" if porao(): define() compativel() On 1/19/07, Geoframer <[EMAIL PROTECT

Re: [Tutor] 'elp!!!!!!!1Totally Clueless Newbie In Distress

2007-01-19 Thread Geoframer
Alright this code is actually littered with bugs, but don't feel bad, because as you state you are new to the whole programming thing. I'll try to explain the things i see going wrong (please take into account that i'm also a new pythonist ;-)) *** You get the error 'variable undefined' because y

Re: [Tutor] Division doesn't work

2007-01-18 Thread Geoframer
Or actually an even easier way is to just to divide bij a float and the end result will also be a float. So in your case divide bij 1024.0 ;-) In [21]: s=14105 In [22]: s/1024.0 Out[22]: 13.7744140625 HTH - Geofram On 1/18/07, Geoframer <[EMAIL PROTECTED]> wrote: You assign s

Re: [Tutor] Division doesn't work

2007-01-18 Thread Geoframer
You assign s as an integer... it should be a float to get the right result... So either define s as s = 14105.0 or as s = float(14105) it'll then result in the right answer : In [17]: s=14105.0 In [18]: s/1024 Out[18]: 13.7744140625 In [19]: s = float(14105) In [20]: s/1024 Out[20]: 13.7744

Re: [Tutor] Python and rpy

2007-01-14 Thread Geoframer
I actually had Numeric under WinXP also, manually installed it and could import Numeric so that wasn't it imho. On 1/11/07, Hugo González Monteverde <[EMAIL PROTECTED]> wrote: Geoframer wrote: > > However i switched to Ubuntu 6.10 today (from WinXP) and to my suprise > it d

Re: [Tutor] Python and rpy

2006-12-28 Thread Geoframer
0} Older version somewhat but apparently this works, so it might just be a bug under windows or in the newer version from Rpy... For now at least I can work with it. Thanx a bunch for all your help Kent. Regards - Geofram On 12/25/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Geoframer wrote

Re: [Tutor] Python and rpy

2006-12-22 Thread Geoframer
ost recent call last): File "rpy-test2.py", line 9, in ? r.kmeans(a, 2, 5, 10, "Forgy") rpy.RException: Error in as.double.default(x) : (list) object cannot be coerced to 'double' Hope you can shed more light on it. Many thanx for your efforts - Geofram On 12/2

[Tutor] Python and rpy

2006-12-21 Thread Geoframer
Okay this might not be the best place to post my question, but on the rpy-list i'm getting no response and i'm really stuck with this problem. Perhaps anyone on here has run into the same problem... I'm thinking my newbieness to python probably is one of the reasons why i fail to see what i'm doin

Re: [Tutor] Need problems to enhance programming skills

2006-10-10 Thread Geoframer
have the programs checked online to see if they are valid. The programming exercises are not specific to python but more of the kind you find in programming contests. You can still get valuable lessons from them though.   Have fun - Geoframer  On 10/10/06, Asrarahmed Kadri <[EMAIL PROTECTED]>

Re: [Tutor] Can my code be optimized any further (speed-wise)?

2006-10-08 Thread Geoframer
'and 'Dive into python' (www.diveintopython.org).So i'm hoping i can soon help people the way you guys helped me ;-) Once again thanks everyone for their suggestions and time!!!Regards - GeoframerOn 10/8/06, Tim Peters < [EMAIL PROTECTED]> wrote:[Geoframer]> The last few d

Re: [Tutor] Can my code be optimized any further (speed-wise)?

2006-10-07 Thread Geoframer
Erm i made a typo   Sample input should ofcourse be without the '!''s   So input = 5 3 5 50 100 125   Sorry - Geoframer  On 10/8/06, Geoframer <[EMAIL PROTECTED]> wrote: The problem is that these assignments are evaluated automatically. So i can not use description strings

Re: [Tutor] Can my code be optimized any further (speed-wise)?

2006-10-07 Thread Geoframer
The problem is that these assignments are evaluated automatically. So i can not use description strings to clearify output or input etc.   Basically it's like this:   a = the number of times i'm going to read input to evaluate lst = the factors of 5. I.e. (5, 5^2, 5^3, 5^4 etc) until the last

Re: [Tutor] error help

2006-10-07 Thread Geoframer
The main problem from what i can tell is that the number of '(' and ')' you use in declarations (and maybe even functions) are not correct.Take for instance :u0prime  = beta*(sqrt(d**2 +(h +length1)**2) - h +length1)) You open 3 '(' and close 4 ')' .The problem is not the little test code at the en

[Tutor] Can my code be optimized any further (speed-wise)?

2006-10-07 Thread Geoframer
Hi everyone,The last few days i've been learning python and have been doing this by trying to solve problems for a programming competition.One particular problem is bugging me. I have already solved it but my solution does not compute in the set time-condition. I know for a fact that this particula