#7763: make nintegrate/nintegral top-level functions
-----------------------------------+----------------------------------------
Reporter: jason | Owner: burcin
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.6.1
Component: calculus | Keywords: beginner
Author: Gagan Sekhon | Upstream: N/A
Reviewer: Karl-Dieter Crisman | Merged:
Work_issues: |
-----------------------------------+----------------------------------------
Changes (by newvalueoldvalue):
* status: needs_review => needs_work
* reviewer: => Karl-Dieter Crisman
* author: => Gagan Sekhon
Comment:
There are two issues with this. First, because of the extreme possibility
for confusion with the already top-level `numerical_integral`function,
this will need some work in documentation. See some of the documentation
in
{{{
sage: sage.calculus.calculus.nintegral??
}}}
for what I mean. I don't think all of that needs to be there, but there
should then be a reference for how to access the rest of it. Basically,
Maxima numerical integration and GSL numerical integration are different.
In particular, one would want to use Maxima for symbolic expressions - in
case there is an exact answer known! - and then have a variety of options
for numerical integration if that fails.
Anyway, that was a longish digression. More importantly, this patch
doesn't exactly do what is asked. The point isn't to be able to
approximate exact answers to integrals, but rather to expose to the top
level the Maxima integration.
{{{
sage: a = e^(-x^4 + x)
sage: a.nintegral(x,0,1)
(1.3638178766496709, 1.5141420080518571e-14, 21, 0)
sage: integral(a,(x,0,1)).n()
1.3638178766496716
}}}
Note the slight difference in output, incidentally - presumably within the
error tolerance, of course. This is because we apparently have a THIRD
way to evaluate integrals - Pynac!
{{{
sage: R = RealField(53)
sage: integral(a,(x,0,1))._convert(R)
1.3638178766496716
}}}
If you check the code for `_convert`, it turns out this goes to Pynac.
See [http://www.ginac.de/reference/integral_8cpp_source.html#l00169 here]
for some of how this happens in Ginac... crazy. We really need to unify
this. But at any rate, we shouldn't use two different algorithms and do
two different things for the same name `nintegrate`.
Anyone have ideas for what the best resolution on this would be?
Oh, and just for comparison:
{{{
sage: numerical_integral(a,0,1)
(1.3638178766496716, 1.5141420080518571e-14)
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7763#comment:6>
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.