#14991: Wrap mpmath's root-finding
-------------------------------+------------------------
       Reporter:  eviatarbach  |        Owner:
           Type:  enhancement  |       Status:  new
       Priority:  major        |    Milestone:  sage-6.1
      Component:  numerical    |   Resolution:
       Keywords:               |    Merged in:
        Authors:               |    Reviewers:
Report Upstream:  N/A          |  Work issues:
         Branch:               |       Commit:
   Dependencies:  #13608       |     Stopgaps:
-------------------------------+------------------------
Changes (by ppurka):

 * dependencies:   => #13608


Comment:

 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:
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/14991#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to