Comment #5 on issue 1211 by ondrej.certik: Getting a value of a function  
does not work or is not possible
http://code.google.com/p/sympy/issues/detail?id=1211

Yes, you need to create a function, like:

In [1]: F = x**2

In [2]: from sympy.mpmath import quadts

In [3]: quadts(lambda t: F({x: t}).evalf(), [-1, 1])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/ondrej/repos/sympy/<ipython console> in <module>()

/home/ondrej/repos/sympy/sympy/mpmath/quadrature.pyc in quadts(*args,  
**kwargs)
     772     """
     773     kwargs['method'] = TanhSinh
--> 774     return quad(*args, **kwargs)
     775
     776 def quadgl(*args, **kwargs):

/home/ondrej/repos/sympy/sympy/mpmath/quadrature.pyc in quad(f, *points,  
**kwargs)
     729         mp.prec += 20
     730         if dim == 1:
--> 731             v, err = rule.summation(f, points[0], prec, epsilon, m,  
verbose)
     732         elif dim == 2:
     733             v, err = rule.summation(lambda x: \

/home/ondrej/repos/sympy/sympy/mpmath/quadrature.pyc in summation(self, f,  
points,
prec, epsilon, max_degree, verbose)
     234                     print "Integrating from %s to %s (degree %s  
of %s)" % \
     235                         (nstr(a), nstr(b), degree, max_degree)
--> 236                 results.append(self.sum_next(f, nodes, degree,  
prec, results,
verbose))
     237                 if degree > 1:
     238                     err = self.estimate_error(results, prec,  
epsilon)

/home/ondrej/repos/sympy/sympy/mpmath/quadrature.pyc in sum_next(self, f,  
nodes,
degree, prec, previous, verbose)
     306         else:
     307             S = mpf(0)
--> 308         S += fdot((w,f(x)) for (x,w) in nodes)
     309         return h*S
     310

/home/ondrej/repos/sympy/sympy/mpmath/mptypes.pyc in fdot(A, B)
    1168     for a, b in A:
    1169         if type(a) not in types: a = mpmathify(a)
-> 1170         if type(b) not in types: b = mpmathify(b)
    1171         a_real = hasattr_(a, "_mpf_")
    1172         b_real = hasattr_(b, "_mpf_")

/home/ondrej/repos/sympy/sympy/mpmath/mptypes.pyc in mpmathify(x, strings)
      99     if hasattr(x, '_mpmath_'):
     100         return mpmathify(x._mpmath_(*prec_rounding))
--> 101     raise TypeError("cannot create mpf from " + repr(x))
     102
     103 def try_convert_mpf_value(x, prec, rounding):

TypeError: cannot create mpf from 0


that it doesn't work seems like a bug in mpmath.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to