On Tuesday, October 16, 2012 1:44:59 PM UTC-4, Dan Drake wrote:
>
> This is strange:
>
> sage: import mpmath
> sage: exp(mpmath.mpf('-0.0712959029907420240935'))
>
> raises "TypeError: 'int' object is not callable". I can, of course, use
> mpmath.exp on the number, but I would expect automatic conversion.
>
> This works, though:
>
> sage: exp(-0.0712959029907420240935)
> 0.93118631054266770709
>
> And if I wrap the mpf in "N( )" to explicitly convert to a regular Sage
> float, it works.
>
>
This will call self.exp(), and apparently mpf numbers don't exponentiate
with that function, but instead:
def exp(self):
"""
Returns the binary exponent of self ::
sage: from mpmath import mpf
sage: mpf(1/64.).exp
-6
"""
return self._mpf_[2]
So there is a name conflict that exp(a) calls a.exp() but in mpmath this
does something totally different.
sage: a = mpmath.mpf('-0.0712959029907420240935')
sage: a.exp
-56
sage: type(a.exp)
<type 'int'>
Yup, can't call that.
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.