2 | | sage: from sage.symbolic.expression_conversions import FastFloatConverter |
3 | | sage: f = FastFloatConverter(x + I) |
4 | | /home/ralf/sage/src/bin/sage-ipython:1: DeprecationWarning: Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future release of Sage; you can use named arguments instead, like EXPR(x=..., y=...) |
5 | | See http://trac.sagemath.org/5930 for details. |
6 | | #!/usr/bin/env python |
7 | | <sage.symbolic.expression_conversions.FastFloatConverter object at 0x7fdec25cf110> |
8 | | sage: f() |
| 2 | sage: find_local_maximum(abs(x+I),-1,1) |
| 3 | --------------------------------------------------------------------------- |
| 4 | TypeError Traceback (most recent call last) |
| 5 | <ipython-input-3-f0919e050ec5> in <module>() |
| 6 | ----> 1 find_local_maximum(abs(x+I),-Integer(1),Integer(1)) |
| 7 | |
| 8 | /home/ralf/sage/src/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.__call__ (build/cythonized/sage/misc/lazy_import.c:3703)() |
| 9 | 352 True |
| 10 | 353 """ |
| 11 | --> 354 return self.get_object()(*args, **kwds) |
| 12 | 355 |
| 13 | 356 def __repr__(self): |
| 14 | |
| 15 | /home/ralf/sage/local/lib/python2.7/site-packages/sage/numerical/optimize.pyc in find_local_maximum(f, a, b, tol, maxfun) |
| 16 | 143 """ |
| 17 | 144 try: |
| 18 | --> 145 return f.find_local_maximum(a=a, b=b, tol=tol, maxfun=maxfun) |
| 19 | 146 except AttributeError: |
| 20 | 147 pass |
| 21 | |
| 22 | /home/ralf/sage/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.find_local_maximum (build/cythonized/sage/symbolic/expression.cpp:66056)() |
| 23 | 11680 (0.561090323458081..., 0.857926501456...) |
| 24 | 11681 """ |
| 25 | > 11682 minval, x = (-self).find_local_minimum(a, b, var=var, tol=tol, |
| 26 | 11683 maxfun=maxfun) |
| 27 | 11684 return -minval, x |
| 28 | |
| 29 | /home/ralf/sage/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.find_local_minimum (build/cythonized/sage/symbolic/expression.cpp:66379)() |
| 30 | 11739 if var is None: |
| 31 | 11740 var = self.default_variable() |
| 32 | > 11741 return find_local_minimum(self._fast_float_(var), |
| 33 | 11742 a=a, b=b, tol=tol, maxfun=maxfun ) |
| 34 | 11743 |
| 35 | |
| 36 | /home/ralf/sage/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression._fast_float_ (build/cythonized/sage/symbolic/expression.cpp:66543)() |
| 37 | 11762 """ |
| 38 | 11763 from sage.symbolic.expression_conversions import fast_float |
| 39 | > 11764 return fast_float(self, *vars) |
| 40 | 11765 |
| 41 | 11766 def _fast_callable_(self, etb): |
| 42 | |
| 43 | /home/ralf/sage/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in fast_float(ex, *vars) |
| 44 | 1572 1.4142135623730951 |
| 45 | 1573 """ |
| 46 | -> 1574 return FastFloatConverter(ex, *vars)() |
| 47 | 1575 |
| 48 | 1576 ################# |
| 49 | |
| 50 | /home/ralf/sage/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in __call__(self, ex) |
| 51 | 215 if getattr(self, 'use_fake_div', False) and (operator is _operator.mul or operator is mul_vararg): |
| 52 | 216 div = self.get_fake_div(ex) |
| 53 | --> 217 return self.arithmetic(div, div.operator()) |
| 54 | 218 return self.arithmetic(ex, operator) |
| 55 | 219 elif operator in relation_operators: |
| 56 | |
| 57 | /home/ralf/sage/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in arithmetic(self, ex, operator) |
| 58 | 1513 operands = ex.operands() |
| 59 | 1514 if operator is _operator.neg: |
| 60 | -> 1515 return operator(self(operands[0])) |
| 61 | 1516 |
| 62 | 1517 from sage.rings.all import Rational |
| 63 | |
| 64 | /home/ralf/sage/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in __call__(self, ex) |
| 65 | 224 return self.tuple(ex) |
| 66 | 225 else: |
| 67 | --> 226 return self.composition(ex, operator) |
| 68 | 227 |
| 69 | 228 def get_fake_div(self, ex): |
| 70 | |
| 71 | /home/ralf/sage/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in composition(self, ex, operator) |
| 72 | 1547 """ |
| 73 | 1548 f = operator |
| 74 | -> 1549 g = [self(_) for _ in ex.operands()] |
| 75 | 1550 try: |
| 76 | 1551 return f(*g) |
| 77 | |
| 78 | /home/ralf/sage/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in __call__(self, ex) |
| 79 | 216 div = self.get_fake_div(ex) |
| 80 | 217 return self.arithmetic(div, div.operator()) |
| 81 | --> 218 return self.arithmetic(ex, operator) |
| 82 | 219 elif operator in relation_operators: |
| 83 | 220 return self.relation(ex, operator) |
| 84 | |
| 85 | /home/ralf/sage/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in arithmetic(self, ex, operator) |
| 86 | 1519 from sage.functions.all import sqrt |
| 87 | 1520 return sqrt(self(operands[0])) |
| 88 | -> 1521 fops = map(self, operands) |
| 89 | 1522 if operator == add_vararg: |
| 90 | 1523 operator = _operator.add |
| 91 | |