Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > any Python equivalent of Math::Polynomial::Solve?

Reply
Thread Tools

any Python equivalent of Math::Polynomial::Solve?

 
 
Just
Guest
Posts: n/a
 
      02-26-2005
While googling for a non-linear equation solver, I found
Math:olynomial::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 module/package that implements that?

Just
 
Reply With Quote
 
 
 
 
Nick Coghlan
Guest
Posts: n/a
 
      02-26-2005
Just wrote:
> While googling for a non-linear equation solver, I found
> Math:olynomial::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 module/package that implements that?
>
> Just


Does SciPy do what you want? Specifically Scientific.Functions.FindRoot [1] &
Scientific.Functions.Polynomial [2]

Regards,
Nick.

[1]
http://starship.python.net/~hinsen/S...entific_9.html
[2]
http://starship.python.net/~hinsen/S...ntific_13.html


--
Nick Coghlan | | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
 
Reply With Quote
 
 
 
 
Just
Guest
Posts: n/a
 
      02-26-2005
In article <mailman.3092.1109434899.22381.python->,
Nick Coghlan <> wrote:

> Just wrote:
> > While googling for a non-linear equation solver, I found
> > Math:olynomial::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 module/package that implements that?
> >
> > Just

>
> Does SciPy do what you want? Specifically Scientific.Functions.FindRoot [1] &
> Scientific.Functions.Polynomial [2]
>
> Regards,
> Nick.
>
> [1]
> http://starship.python.net/~hinsen/S...thonManual/Sci
> entific_9.html
> [2]
> http://starship.python.net/~hinsen/S...thonManual/Sci
> entific_13.html


(Hm, I had the impression that scipy != Konrad Hinsen's Scientific
module.)

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?

Just
 
Reply With Quote
 
Terry Reedy
Guest
Posts: n/a
 
      02-26-2005

"Just" <> wrote in message
news:just-...
>> Does SciPy do what you want? Specifically Scientific.Functions.FindRoot
>> [1] &
>> Scientific.Functions.Polynomial [2]
>> http://starship.python.net/~hinsen/S...thonManual/Sci
>> entific_9.html
>> [2]
>> http://starship.python.net/~hinsen/S...thonManual/Sci
>> entific_13.html

>
> (Hm, I had the impression that scipy != Konrad Hinsen's Scientific
> module.)


www.scipy.org (first hit on "Python SciPy" google search)

Terry J. Reedy



 
Reply With Quote
 
John M. Gamble
Guest
Posts: n/a
 
      02-26-2005
In article <just->,
Just <> wrote:
>While googling for a non-linear equation solver, I found
>Math:olynomial::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 poly_root()
>functionality (which solves arbitrary polynomials). Does anyone know of
>a Python module/package that implements that?


Are you looking for that particular algorithm, or for any
source that will find the roots of the polynomial? 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.

--
-john

February 28 1997: Last day libraries could order catalogue cards
from the Library of Congress.
 
Reply With Quote
 
Just
Guest
Posts: n/a
 
      02-26-2005
In article <cvqgn5$n0b$>,
(John M. Gamble) wrote:

> In article <just->,
> Just <> wrote:
> >While googling for a non-linear equation solver, I found
> >Math:olynomial::Solve in CPAN. It seems a great little module, except

>
> Thank you.
>
> >it's not Python...

>
> Sorry about that.


Heh, how big are the odds you find the author of an arbitrary Perl
module on c.l.py...

> > I'm especially looking for its poly_root()
> >functionality (which solves arbitrary polynomials). Does anyone know of
> >a Python module/package that implements that?

>
> Are you looking for that particular algorithm, or for any
> source that will find the roots of the polynomial?


Any will do. As I wrote in another post, I'm currently only looking for
a quintic equation solver, which your module does very nicely.

> 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 (following the instruction in Solve.pm
didn't work for me ).

Just
 
Reply With Quote
 
John M. Gamble
Guest
Posts: n/a
 
      02-26-2005
In article <just->,
Just <> 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 your module does very nicely.
>
>> 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 (following the instruction in Solve.pm
>didn't work for me ).
>


Ouch. I just did a quick search and found that that site has undergone
a few changes, and the code that i reference is missing. A few other
links in the docs are stale too. I need to update the documentation.

Anyway, doing a search for 'hqr' and Eispack got me a lot of sites.
In particular, this one is pretty friendly:

<http://netlib.enseeiht.fr/eispack/>

Look at the source for balanc.f (does the prep-work) and hqr.f
(does the solving). Minor annoyance: the real and imaginary
parts of the roots are in separate arrays. I combined them into
complex types in my perl source, in case you want to make a
comparison.

Of course, all this may be moot if the other suggestions
work out.

--
-john

February 28 1997: Last day libraries could order catalogue cards
from the Library of Congress.
 
Reply With Quote
 
Just
Guest
Posts: n/a
 
      02-26-2005
In article <cvqmvt$2rm$>,
(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 (following the instruction in Solve.pm
> >didn't work for me ).
> >

>
> Ouch. I just did a quick search and found that that site has undergone
> a few changes, and the code that i reference is missing. A few other
> links in the docs are stale too. I need to update the documentation.
>
> Anyway, doing a search for 'hqr' and Eispack got me a lot of sites.
> In particular, this one is pretty friendly:
>
> <http://netlib.enseeiht.fr/eispack/>
>
> Look at the source for balanc.f (does the prep-work) and hqr.f
> (does the solving). Minor annoyance: the real and imaginary
> parts of the roots are in separate arrays. I combined them into
> complex types in my perl source, in case you want to make a
> comparison.


Thanks! I'll check that out.

> Of course, all this may be moot if the other suggestions
> work out.


SciPy indeed appear to contain a solver, but I'm currently stuck in
trying to _get_ it for my platform (OSX). I'm definitely not going to
install a Fortran compiler just to evaluate it (even though my name is
not "Ilias" . Also, SciPy is _huge_, so maybe a Python translation of
that Fortran code or your Perl code will turn out to be more attractive
after all...

Just
 
Reply With Quote
 
Raymond L. Buvel
Guest
Posts: n/a
 
      02-27-2005
Just wrote:
<snip>
>
> SciPy indeed appear to contain a solver, but I'm currently stuck in
> trying to _get_ it for my platform (OSX). I'm definitely not going to
> install a Fortran compiler just to evaluate it (even though my name is
> not "Ilias" . Also, SciPy is _huge_, so maybe a Python translation of
> that Fortran code or your Perl code will turn out to be more attractive
> after all...
>
> Just


The GNU Scientific Library has a nice root finder for polynomials with
real coefficients. I have wrapped this with Pyrex to work with my
ratfun module see:

http://calcrpnpy.sourceforge.net/ratfun.html

If this will suit your needs, I can send you an alpha release of the
package with the root finder. It is not pure Python. I requires Pyrex
and a C compiler to install. My guess is that it will work on OSX as
well as it does on Linux. This functionality will be included in the
next release of the ratfun package but I still have to unit test a
number of components and update the documentation. Consequently, an
official release will not happen soon.

Ray
 
Reply With Quote
 
Just
Guest
Posts: n/a
 
      02-27-2005
In article <I68Ud.577$>,
"Raymond L. Buvel" <> wrote:

> Just wrote:
> <snip>
> >
> > SciPy indeed appear to contain a solver, but I'm currently stuck in
> > trying to _get_ it for my platform (OSX). I'm definitely not going to
> > install a Fortran compiler just to evaluate it (even though my name is
> > not "Ilias" . Also, SciPy is _huge_, so maybe a Python translation of
> > that Fortran code or your Perl code will turn out to be more attractive
> > after all...
> >
> > Just

>
> The GNU Scientific Library has a nice root finder for polynomials with
> real coefficients. I have wrapped this with Pyrex to work with my
> ratfun module see:
>
> http://calcrpnpy.sourceforge.net/ratfun.html
>
> If this will suit your needs, I can send you an alpha release of the
> package with the root finder. It is not pure Python. I requires Pyrex
> and a C compiler to install. My guess is that it will work on OSX as
> well as it does on Linux. This functionality will be included in the
> next release of the ratfun package but I still have to unit test a
> number of components and update the documentation. Consequently, an
> official release will not happen soon.


Thank you, I'll check this out. I had come across GSL, but not Python
bindings. (GPL is probably a problem for my project, but it's very good
to know anyway.)

On the other hand, I just finished translating the relevant portions of
Math:olynomial::Solve to Python, so I'm probably all set, at least for
now. Thanks everyone for the responses, especially to John Gamble!

Just
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any equivalent feature available in Python..? zaheer.agadi@gmail.com Python 3 02-25-2009 04:17 AM
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
IS THERE ANY EQUIVALENT TO DISPOSE()? abenm613@mail.ru Java 7 12-13-2005 02:25 AM
Any Eclipse equivalent to WSAD server perspective? Jay Eckles Java 1 02-19-2004 08:39 AM
any telnetlib equivalent in Python for rlogin? walala Python 2 11-12-2003 02:40 PM



Advertisments