Re: [Numpy-discussion] ndarray from column data

2009-07-03 Thread Francesc Alted
A Thursday 02 July 2009 20:15:13 Dan Yamins escrigué: What's wrong with recarrays? In any case, if you need a true ndarray object you can always do: ndarr = recarr.view(np.ndarray) and you are done. I have a question about this though. The object ndarr will consist of records,

Re: [Numpy-discussion] Using loadtxt to read in mixed data types

2009-07-03 Thread Neil Crighton
Pierre GM pgmdevlist at gmail.com writes: What about 'formats':[eval(b) for b in event_format] Should it fail, try something like: dtype([(x,eval(b)) for (x,b) in zip(event_fields, event_format)]) At least you force dtype to have the same nb of names formats. You could use data =

[Numpy-discussion] argwhere does not accept py list

2009-07-03 Thread Sebastian Haase
Hi, should this not be accepted: N.argwhere([4,0,2,1,3]) ? instead I get Traceback (most recent call last): File input, line 1, in module File ./numpy/core/numeric.py, line 510, in argwhere AttributeError: 'list' object has no attribute 'nonzero' N.argwhere(N.array([4,0,2,1,3])) [[0] [2]

[Numpy-discussion] roots and high-order polynomial

2009-07-03 Thread Fabrice Silva
Hello Has anyone looked at the behaviour of the (polynomial) roots function for high-order polynomials ? I have an application which internally searches for the roots of a polynomial. It works nicely for order less than 20, and then has an erratic behaviour for upper values... I looked into the

Re: [Numpy-discussion] roots and high-order polynomial

2009-07-03 Thread Nils Wagner
On Fri, 03 Jul 2009 11:48:45 +0200 Fabrice Silva si...@lma.cnrs-mrs.fr wrote: Hello Has anyone looked at the behaviour of the (polynomial) roots function for high-order polynomials ? I have an application which internally searches for the roots of a polynomial. It works nicely for order

Re: [Numpy-discussion] argwhere does not accept py list

2009-07-03 Thread Scott Sinclair
2009/7/3 Sebastian Haase seb.ha...@gmail.com: Hi, should this not be accepted: N.argwhere([4,0,2,1,3]) ? instead I get Traceback (most recent call last):  File input, line 1, in module  File ./numpy/core/numeric.py, line 510, in argwhere AttributeError: 'list' object has no attribute

Re: [Numpy-discussion] roots and high-order polynomial

2009-07-03 Thread Fabrice Silva
Le vendredi 03 juillet 2009 à 11:52 +0200, Nils Wagner a écrit : You will need multiprecision arithmetic in that case. It's an ill-conditioned problem. I may have said that the solution are of the same order of magnitude, so that the ratio between the lowest and the highest absolute values of

Re: [Numpy-discussion] roots and high-order polynomial

2009-07-03 Thread Fabrice Silva
Le vendredi 03 juillet 2009 à 14:43 +0200, Nils Wagner a écrit : Just curious - Can you provide us with the coefficients of your polynomial ? Working case : Polynomial.c = [ -1.34100085e+57 +0.e+00j -2.28806781e+55 +0.e+00j -4.34808480e+54 -3.27208577e+36j

Re: [Numpy-discussion] roots and high-order polynomial

2009-07-03 Thread Charles R Harris
On Fri, Jul 3, 2009 at 3:48 AM, Fabrice Silva si...@lma.cnrs-mrs.fr wrote: Hello Has anyone looked at the behaviour of the (polynomial) roots function for high-order polynomials ? I have an application which internally searches for the roots of a polynomial. It works nicely for order less

Re: [Numpy-discussion] roots and high-order polynomial

2009-07-03 Thread Dag Sverre Seljebotn
Fabrice Silva wrote: Le vendredi 03 juillet 2009 à 11:52 +0200, Nils Wagner a écrit : You will need multiprecision arithmetic in that case. It's an ill-conditioned problem. I may have said that the solution are of the same order of magnitude, so that the ratio between the lowest and the

Re: [Numpy-discussion] roots and high-order polynomial

2009-07-03 Thread Pauli Virtanen
On 2009-07-03, Charles R Harris charlesr.har...@gmail.com wrote: roots? The connection between polynomial coefficients and polynomial values becomes somewhat vague when the polynomial degree becomes large, it is numerically ill conditioned. In addition to switching to higher precision than

[Numpy-discussion] Bug in the F distribution?

2009-07-03 Thread Alan Jackson
I either found a bug in the F distribution, or I'm really messed up. From a table I find dfnum dfden F(P.01) 10 10 4.85 11 10 4.78 11 11 4.46 10 11 4.54 So let's calculate the same quantities using numpy... import scipy.stats as stats import numpy as np In

Re: [Numpy-discussion] Bug in the F distribution?

2009-07-03 Thread Alan Jackson
I've tried the same scheme using R and it seems to give the right answers quantile( rf(1000,10,10), .99) 99% 4.84548 quantile( rf(1000,11,10), .99) 99% 4.770002 quantile( rf(1000,11,11), .99) 99% 4.465655 quantile( rf(1000,10,11), .99) 99% 4.539423

[Numpy-discussion] __eq__ method for recarray returns recarray

2009-07-03 Thread Dan Yamins
If I have two recarrays with the same len and column headers, the __eq__ method returns the rich comparison, which is great. E.g. In [20]: x = np.rec.fromrecords([(1,2,'dd',.3),(33,2,'y',2.2),(2,3,'a',21.4),(3,4,'b',33.2)],names=['A','B','C','D']) In [21]: y =