Bug 1127796 - mpmath: calculus/polynomials.py doesn't define orig
Summary: mpmath: calculus/polynomials.py doesn't define orig
Alias: None
Product: Fedora
Classification: Fedora
Component: python-mpmath
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Susi Lehtola
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2014-08-07 14:56 UTC by Jerry James
Modified: 2014-12-17 04:49 UTC (History)
3 users (show)

Fixed In Version: python-mpmath-0.19-2.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-12-17 04:49:51 UTC

Attachments (Terms of Use)
Patch to fix the polyroots function (361 bytes, patch)
2014-12-04 18:29 UTC, Jerry James
no flags Details | Diff

Description Jerry James 2014-08-07 14:56:02 UTC
Description of problem:

>>> from mpmath import *
>>> mp.dps = 15; mp.pretty = True
>>> nprint(polyroots([1,-1,-14,24], error=True), 4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/mpmath/calculus/polynomials.py", line 201, in polyroots
    err = max(err, ctx.ldexp(1, -orig+1))
NameError: global name 'orig' is not defined

This used to work with python-mpmath-0.18-1 on F20.  This is causing a sympy test failure on Rawhide and F20.  It looks like an "orig = ctx.prec" statement is missing from that function.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Run the python code shown above

Actual results:
An error.

Expected results:
([-4.0, 2.0, 3.0], 2.22e-16)

Additional info:

Comment 1 Jerry James 2014-08-07 15:09:55 UTC
I just reported this in upstream's Google Groups forum.  It appears there is a second problem with the polyroots function, leading to lack of convergence on a solution in some cases, so it may be worth waiting for upstream to investigate that issue.

Comment 2 Jerry James 2014-12-04 18:29:22 UTC
Created attachment 964784 [details]
Patch to fix the polyroots function

The second bug can be worked around, but this one cannot.  Would you please do a build of mpmath with the attached patch applied?

Comment 3 Fedora Update System 2014-12-05 00:05:28 UTC
python-mpmath-0.19-2.fc20 has been submitted as an update for Fedora 20.

Comment 4 Fedora Update System 2014-12-05 00:05:35 UTC
python-mpmath-0.19-2.fc21 has been submitted as an update for Fedora 21.

Comment 5 lnie 2014-12-05 03:17:01 UTC
python-mpmath-0.19-2.fc21 works

Comment 6 Fedora Update System 2014-12-06 02:27:59 UTC
Package python-mpmath-0.19-2.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-mpmath-0.19-2.fc20'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2014-12-17 04:49:51 UTC
python-mpmath-0.19-2.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.