-
-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make nintegrate/nintegral top-level functions #7763
Comments
comment:3
Is this supposed to be a numerical approximation of the integral function? |
comment:4
Replying to @sagetrac-ryan:
No, this is an existing method of symbolic functions, which uses a different algorithm to get a numerical integral. But you can only call it in
not as a top-level
type function. We should also probably make the syntax like that of |
Reviewer: Karl-Dieter Crisman |
comment:6
There are two issues with this. First, because of the extreme possibility for confusion with the already top-level
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.
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!
If you check the code for Anyone have ideas for what the best resolution on this would be? Oh, and just for comparison:
|
Author: Gagan Sekhon |
comment:7
And of course a more informative commit message :) Don't worry, this is on the way to being a good contribution; we just have to figure out what the right thing to do is. |
comment:8
Thank you, this actually gives me a better project and finding random tickets. I will try doing what you asked here. |
comment:9
There are two different inconsistency numerical_integral is top level only function and it uses gsl nintegral is not top level and uses maxima for consistency purpose I was thinking of doing the following:
Any thoughts? |
comment:10
As for other integra all have either no algorithm option and uses maxima or only uses maxima. Still thinking the least complicated way to clean this up with most flexibility. |
comment:11
Maybe the best thing to do would be to have ONE top level function for numerical integration (
so that it guesses what the correct variable is. It also makes it really hard to do numerical integration on the fly with it, because you can't do this very easily. In that case, it would be easy to have several different algorithms. I don't know which would be better; in some sense, it would be best to always first see if we get an exact answer from Maxima, and if not, then do a numerical integral. Or should it always do a straight-up numerical integral (whether from GSL, Maxima, Gi/Pynac...)? As you can see, even trying to solve pretty 'easy' tickets can open a can of worms! Keep up the effort, though, it is much appreciated. |
comment:12
I am still working on this, but wanted to add a patch to show the progress. |
comment:13
Replying to @sagetrac-gagansekhon:
the new patch integration.patch has the new and only progress. |
comment:14
Thanks, good to see this! I would caution that for annoying reasons we like to have the lines in the documentation be fairly short; see some of the other calculus or plotting files for examples of about how many characters (80? 84?) are appropriate. (Otherwise it looks really bad in command line.) So any updates should fix that. |
Attachment: integration.patch.gz |
comment:15
Attachment: trac_7763.6.patch.gz |
comment:16
Replying to @sagetrac-gagansekhon: |
comment:17
Attachment: trac_7763.7.patch.gz To buildbot: apply trac_7763.7.patch only. (I think that the .6 and .7 patches must be identical, but it doesn't matter.) |
comment:18
Trac_7763.8.patch is the patch with everything, including commit line. |
comment:19
Again, a good start at this! Unfortunately, there are now MANY small issues that need to be cleared up before testing and positive review can occur. I don't see any of these as insurmountable. However, I'm definitely removing the 'beginner' tag, given that this has become a more subtle ticket. First, there are still a fair number of typos, English issues like
This comment still applies. Another interesting thing is the use of The private function
is not quite accurate, as it's doing more than that :) I'm not sure whether the Mma or sympy ones actually will return numerical values. Also, one should doctest all those options. What is the idea with calling the other numerical integral (from Maxima) I think you now have Anyway, all doable things, and the final produce will be quite valuable. (As a final comment, it would be worth seeing whether the issues at this discussion are solved with this ticket. I don't believe so - since these integrals aren't made symbolic - but it's worth checking.) |
comment:20
Replying to @kcrisman:
I have read this line several time and can't figure out what it is trying to say, perhaps someone else can tell me what it should be. Fixed and hopefully links to the functions put in - see the plotting functions, especially plot.py, for examples of how to do that in Sphinx. Did you want links each function listed in the file? Like a table of contents.
I tried to make the lines shorter, but the html file looked wierd. Html file formats each line and wraps it around. If I make them them shorter the documentation doesn't come out right.
Actually, there are several different sets of keywords depending on the algorithm provided. I think the syntax for this should be like for symbolic integrals, e.g. The reason I went with alg, was that for alg="gsl", algorithm is one of the keywords already being used.
added
I tested mma and you are right it gives an error, though the actual function it is calling makes it seem like it should work. Sympy, however does return numerical values for symbolic functions with closed form. Added doctest for all algorithms
This used to be nintegral and is imported by symbolic.integration for f.nintegral. I kept this because it has different output than numerical_integral (both old and new)
This was already there, I will read the documentation for that function and see if it is still needed.
This is still open, but if one uses integral instead of numerical_integral it works. Since the result until the numerical values are inputed is not numeric, but a function in x, and y , numerical_integral should perhaps not be used. |
comment:21
Attachment: trac_7763.8.patch.gz Thanks for clearing up some of my misunderstandings. I don't have time to look at this today, but hopefully within a week? Just a couple clarifications:
I mean like
Hmm, that's odd. I'll have to check it out; in most files we do this. Maybe we've just been living with weird HTML :) |
comment:22
See also #8321. We continue to get support requests because of the non-unified nature of our options. |
comment:23
It turns out that the current top-level function, |
We just need to add them to sage/devel/sage/misc/functional.py. Modifying the versions of integrate/integral in that file would probably be easiest.
CC: @kcrisman @jasongrout @sagetrac-mhampton
Component: calculus
Author: Gagan Sekhon
Reviewer: Karl-Dieter Crisman
Issue created by migration from https://trac.sagemath.org/ticket/7763
The text was updated successfully, but these errors were encountered: