Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap mpmath's root-finding #14991

Open
eviatarbach opened this issue Jul 31, 2013 · 3 comments
Open

Wrap mpmath's root-finding #14991

eviatarbach opened this issue Jul 31, 2013 · 3 comments

Comments

@eviatarbach
Copy link

Sage should wrap mpmath's root-finding; it has many algorithms available, arbitrary precision, and support for complex roots, none of which the current find_root appears to have.

Depends on #13608

CC: @burcin @fredrik-johansson @mforets @nbruin @ppurka @slel

Component: numerical

Keywords: find_root, mpmath

Issue created by migration from https://trac.sagemath.org/ticket/14991

@eviatarbach eviatarbach added this to the sage-6.1 milestone Jul 31, 2013
@ppurka
Copy link
Member

ppurka commented Jan 29, 2014

comment:2

This depends on #13608 for it to be of any use. Because of this default behavior:

sage: from mpmath import findroot
sage: f(x) = log(x+2) - x   
sage: findroot(f, (0, 0.5))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-90ff3b38dfea> in <module>()
----> 1 findroot(f, (Integer(0), RealNumber('0.5')))

/home/punarbasu/tmp/sage/local/lib/python2.7/site-packages/mpmath/calculus/optimization.pyc in findroot(ctx, f, x0, solver, tol, verbose, verify, **kwargs)
    926             multidimensional = isinstance(fx, (list, tuple, ctx.matrix))
    927         except TypeError:
--> 928             fx = f(x0[0])
    929             multidimensional = False
    930         if 'multidimensional' in kwargs:

/home/punarbasu/tmp/sage/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.__call__ (sage/symbolic/expression.cpp:20616)()

/home/punarbasu/tmp/sage/local/lib/python2.7/site-packages/sage/symbolic/callable.pyc in _call_element_(self, _the_element, *args, **kwds)
    475         d = dict(zip(map(repr, self.arguments()), args))
    476         d.update(kwds)
--> 477         return SR(_the_element.substitute(**d))
    478 
    479 

/home/punarbasu/tmp/sage/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.substitute (sage/symbolic/expression.cpp:19871)()

/home/punarbasu/tmp/sage/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.coerce_in (sage/symbolic/expression.cpp:14074)()

/home/punarbasu/tmp/sage/local/lib/python2.7/site-packages/sage/structure/parent_old.so in sage.structure.parent_old.Parent._coerce_ (sage/structure/parent_old.c:3909)()

/home/punarbasu/tmp/sage/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.coerce (sage/structure/parent.c:9544)()

TypeError: no canonical coercion from <type 'sage.libs.mpmath.ext_main.mpf'> to Callable function ring with arguments (x,)
sage: 

@ppurka
Copy link
Member

ppurka commented Jan 29, 2014

Dependencies: #13608

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@slel
Copy link
Member

slel commented Dec 14, 2018

Changed keywords from none to find_root, mpmath

@slel slel removed this from the sage-6.4 milestone Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants