On Fri, Sep 17, 2010 at 12:48 AM, maldun <[email protected]> wrote:
> Do you see the problems?! These are caused by the high oscillation,
> but we get no warning.
> If you use scipy you would get the following:
It is possible to get an error estimate back from mpmath, as follows:
sage: mpmath.quad(lambda a: mpmath.exp(a)*mpmath.sin(1000*a),
[0,mpmath.pi], error=True)
(mpf('-0.71920642950258207'), mpf('1.0'))
sage: mpmath.quad(lambda a: mpmath.exp(a)*mpmath.sin(1000*a),
[0,mpmath.pi], maxdegree=15, error=True)
(mpf('-0.022140670492108779'), mpf('1.0e-37'))
Currently it doesn't seem to work with mpmath.call (because
mpmath_to_sage doesn't know what to do with a tuple).
The error estimates are also somewhat bogus (in both examples above --
the first value has been capped to 1.0, if I remember correctly what
the code does, and the second is an extrapolate of the quadrature
error alone and clearly doesn't account for the arithmetic error). But
it should be sufficient to correctly detect a problem and signal a
warning in the Sage wrapper code in typical cases.
I'm currently working on rewriting the integration code in mpmath to
handle error estimates more rigorously and flexibly. This will work
much better in a future version of mpmath.
Fredrik
--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org