|
| Did you perhaps use a list (type(p) == type([])) for p?
|
Alex
Using the coefficients in an array instead of a list
was the key in the solution to my problems
Your other suggestions regarding floating p
and the off-by-one error that I had with the
polynomial
Cousin Stanley wrote:
Alex
Thanks for posting your generalized numarray
eigenvalue solution
It's been almost 30 years since I've looked at
any characteristic equation, eigenvalue, eignevector
type of processing and at this point I don't recall
many of the particulars
Raymond L. Buvel wrote:
Alex Renelt wrote:
Alex Renelt wrote:
in addition:
I'm writing a class for polynomial manipulation. The generalization
of the above code is:
definitions:
1.) p = array([a_0, a_i, ..., a_n]) represents your polynomial
P(x) = \sum _{i=0} ^n a_i x^i
2.) deg(p) is its degree
| In case you are still interested pygsl wraps the GSL solver.
|
| from pygsl import poly
|
| pc = poly.poly_complex( 3 )
|
| tmp, rs = pc.solve( ( 2 , 3 , 1 ) )
|
| print rs
|
|
| You get pygsl at http://sourceforge.net/projects/pygsl/
Pierre
I am still interested and have
Carl Banks wrote:
If you don't have a great need for speed, you can accomplish this
easily with the linear algebra module of Numeric/numarray. Suppose
your quintic polynomial's in the form
a + b*x + c*x**2 + d*x**3 + e*x**4 + x**5
The roots of it are equal to the eigenvalues of the
Alex
Thanks for posting your generalized numarray
eigenvalue solution
It's been almost 30 years since I've looked at
any characteristic equation, eigenvalue, eignevector
type of processing and at this point I don't recall
many of the particulars
Not being sure about
In case you are still interested pygsl wraps the GSL solver.
snip
from pygsl import poly
pc = poly.poly_complex(3)
tmp, rs = pc.solve((2,3,1))
print rs
/snip
You get pygsl at http://sourceforge.net/projects/pygsl/
Pierre
--
http://mail.python.org/mailman/listinfo/python-list
Just wrote:
In article [EMAIL PROTECTED],
Carl Banks [EMAIL PROTECTED] wrote:
It should be pretty easy to set up a Numeric matrix and call
LinearAlgebra.eigenvalues. For example, here is a simple quintic
solver:
. from Numeric import *
. from LinearAlgebra import *
.
. def quinticroots(p):
.
Alex Renelt wrote:
in addition:
I'm writing a class for polynomial manipulation. The generalization of
the above code is:
definitions:
1.) p = array([a_0, a_i, ..., a_n]) represents your polynomial
P(x) = \sum _{i=0} ^n a_i x^i
2.) deg(p) is its degree
3.) monic(p) makes P monic, i.e. monic(p) =
Alex Renelt wrote:
Alex Renelt wrote:
in addition:
I'm writing a class for polynomial manipulation. The generalization of
the above code is:
definitions:
1.) p = array([a_0, a_i, ..., a_n]) represents your polynomial
P(x) = \sum _{i=0} ^n a_i x^i
2.) deg(p) is its degree
3.) monic(p) makes P
On 2005-02-26, Just [EMAIL PROTECTED] wrote:
While googling for a non-linear equation solver, I found
Math::Polynomial::Solve in CPAN. It seems a great little module, except
it's not Python... I'm especially looking for its poly_root()
functionality (which solves arbitrary polynomials).
Carl Banks wrote:
. from Numeric import *
. from LinearAlgebra import *
.
. def quinticroots(p):
. cm = zeros((5,5),Float32)
. cm[0,1] = cm[1,2] = cm[2,3] = cm[3,4] = 1.0
. cm[4,0] = -p[0]
. cm[4,1] = -p[1]
. cm[4,2] = -p[2]
. cm[4,3] = -p[3]
. cm[4,4] =
Just wrote:
While googling for a non-linear equation solver, I found
Math::Polynomial::Solve in CPAN. It seems a great little module, except
it's not Python... I'm especially looking for its poly_root()
functionality (which solves arbitrary polynomials). Does anyone know of
a Python
Just [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Does SciPy do what you want? Specifically Scientific.Functions.FindRoot
[1]
Scientific.Functions.Polynomial [2]
http://starship.python.net/~hinsen/ScientificPython/ScientificPythonManual/Sci
entific_9.html
[2]
In article [EMAIL PROTECTED],
Just [EMAIL PROTECTED] wrote:
While googling for a non-linear equation solver, I found
Math::Polynomial::Solve in CPAN. It seems a great little module, except
Thank you.
it's not Python...
Sorry about that.
I'm especially looking for its
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] (John M. Gamble) wrote:
In article [EMAIL PROTECTED],
Just [EMAIL PROTECTED] wrote:
While googling for a non-linear equation solver, I found
Math::Polynomial::Solve in CPAN. It seems a great little module, except
Thank you.
it's not
In article [EMAIL PROTECTED],
Just [EMAIL PROTECTED] wrote:
Heh, how big are the odds you find the author of an arbitrary Perl
module on c.l.py...
Hey, that's why it's called lurking.
Any will do. As I wrote in another post, I'm currently only looking for
a quintic equation solver, which
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] (John M. Gamble) wrote:
The
original source for the algorithm used in the module is
from Hiroshi Murakami's Fortran source, and it shouldn't
be too difficult to repeat the translation process to python.
Ah ok, I'll try to locate that
Just wrote:
(Hm, I had the impression that scipy != Konrad Hinsen's Scientific
module.)
You're probably right :)
I had played with [1], but it only calculates one root, and I need all
roots (specifically, for a quintic equation). [2] doesn't seem to be a
solver?
Actually, I was curious whether
Just wrote:
While googling for a non-linear equation solver, I found
Math::Polynomial::Solve in CPAN. It seems a great little module,
except
it's not Python... I'm especially looking for its poly_root()
functionality (which solves arbitrary polynomials). Does anyone know
of
a Python
20 matches
Mail list logo