#8321: numerical integration with arbitrary precision
-------------------------+--------------------------------------------------
Reporter: burcin | Owner:
Type: defect | Status: needs_work
Priority: major | Milestone: sage-4.7.2
Component: symbolics | Keywords: numerics,integration
Work_issues: | Upstream: N/A
Reviewer: | Author: Stefan Reiterer
Merged: | Dependencies:
-------------------------+--------------------------------------------------
Comment(by benjaminfjones):
Replying to [comment:38 fredrik.johansson]:
> The singleton trick definitely needs to be implemented; it can save a
factor 4x or more.
I understand what you are saying about the class being instantiated on
every call. Can you explain what you mean by the "singleton trick"?
> Then there is the question of whether to use !GaussLegendreRel or
!TanhSinhRel by default. Gauss-Legendre is somewhat faster for smooth
integrands; Tanh-Sinh is much better for something like {{{sqrt(-x^2 +
1)}}} on {{{[0,1]}}} (note that the values with mpmath_rel above are
wrong!) or almost anything on an infinite interval (this should be tested
as well!). I would favor !TanhSinhRel.
>
> Anyway, I agree that it would be sensible to use GSL by default.
For `mp_f = sqrt(1-x**2)`, here is what TanhSinhRel gives in comparison
with GaussLengendreRel and with absolute errors, as well as the approx. of
the exact answer pi/4:
{{{
sage: mp_f = lambda z: f(x = mpmath.mpmath_to_sage(z, 53))
sage: mpmath.call(mpmath.quad, mp_f, [a, b])
0.785398163397448
sage: mpmath.call(mpmath.quad, mp_f, [a, b], method=GaussLegendreRel)
0.785398325435763
sage: mpmath.call(mpmath.quad, mp_f, [a, b], method=TanhSinhRel)
0.785398163397448
sage: N(pi/4)
0.785398163397448
}}}
ps. somehow I read your second to last comment (about the relative error)
and thought it was written by Burcin (hence my reference to his name in my
reply). Sorry :)
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8321#comment:39>
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 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/sage-trac?hl=en.