-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
Use the faster libgiac interface for "giac" integration #38686
Use the faster libgiac interface for "giac" integration #38686
Conversation
f12c887
to
093c840
Compare
Documentation preview for this PR (built with commit 09572b1; changes) is ready! 🎉 |
AFAICS the CI failure is an unrelated timeout:
|
This looks like a good idea, thanks. |
I didn't see the label change, thanks for the review. |
I'm getting
|
093c840
to
8db21a2
Compare
These are the same anwer. I updated the expected output.
Nothing too scary here. This doctest already looks for the warning output on the previous line, where
This one on the other hand is a treat. It's reproducible using In any case, I was able to work around it. Don't ask me what the difference is, but giac likes |
Part of sagemath#38668. If it's going to be possible to disable giac, we need to guard all of the tests that use it with either `# needs giac` or `# needs sage.libs.giac`. I think I've gotten them all. A crude way to test: 1. `git rm -r src/sage/libs/giac` and rebuild to disable sage.libs.giac 2. build sage, and then delete the giac executable to disable the pexpect interface If you do these one at a time, it should ensure that the correct tags are used. (Typically, if giac is missing, neither sage.libs.giac nor the giac executable will be present, making it very easy to mix up the tags.) For bonus points you can undelete `src/sage/libs/giac` after building but before testing to make sure the "needs" tags in those files are accurate. ### Dependencies: * sagemath#38756 * sagemath#38686 (not strictly required, but it adds a few "needs sage.libs.giac" tags of its own) URL: sagemath#38770 Reported by: Michael Orlitzky Reviewer(s): Tobias Diez
Part of sagemath#38668. If it's going to be possible to disable giac, we need to guard all of the tests that use it with either `# needs giac` or `# needs sage.libs.giac`. I think I've gotten them all. A crude way to test: 1. `git rm -r src/sage/libs/giac` and rebuild to disable sage.libs.giac 2. build sage, and then delete the giac executable to disable the pexpect interface If you do these one at a time, it should ensure that the correct tags are used. (Typically, if giac is missing, neither sage.libs.giac nor the giac executable will be present, making it very easy to mix up the tags.) For bonus points you can undelete `src/sage/libs/giac` after building but before testing to make sure the "needs" tags in those files are accurate. ### Dependencies: * sagemath#38756 * sagemath#38686 (not strictly required, but it adds a few "needs sage.libs.giac" tags of its own) URL: sagemath#38770 Reported by: Michael Orlitzky Reviewer(s): Tobias Diez
Add `# needs sage.libs.giac`, from sagemath/sage#38686 by @orlitzky, cherry picked
8db21a2
to
2be5a18
Compare
I went back and reworked this. |
Before this commit, signed Sage infinities would be converted to unsigned Giac infinities: sage: libgiac(+Infinity) Infinity This can mess up your integrals, if nothing else. To fix it, we add an additional case to the Pygen constructor. Sage's AnInfinity class already knows how to convert itself to a Giac-friendly string, and Pygen already knows what to do with those strings -- we just need to put the pieces together. A new test case is added as well.
…egration The library interface to libgiac is much more efficient than the pexpect one, but the name algorithm="giac" is more attractive (especially to newcomers) than algorithm="libgiac". We should just Do The Right Thing and use libgiac when "giac" is requested.
The pexpect integrator is unused now that the "giac" integrator uses libgiac. We also add a few "# needs sage.libs.giac" tags to the tests that use the libgiac integrator, because they obviously will fail when libgiac is not there.
One example in this file integrates with algorithm='giac', which can fail if sage.libs.giac is not available to perform the integration.
One example in this file integrates with algorithm='giac', which can fail if sage.libs.giac is not available to perform the integration.
…tegration A few examples in this file integrate with algorithm='giac', which can fail if sage.libs.giac is not available to perform the integration.
There's one test in this file for an integral where the "libgiac" algorithm prints a warning, but the old "giac" algorithm did not. Now that algorithm="giac" uses libgiac, we expect the warning in that case too.
One "giac" integral in this file has changed its output slightly now that the "giac" algorithm uses libgiac as opposed to the pexpect interface. The difference between the new and old expected outputs full_simplify() to zero, so this one is nothing to worry about.
With the recent improvement to the handling of signed infinities in libgiac, this warning about singular points has vanished.
A comment in this file about failing doctests is still partially true (the doctests fail if you remove the workaround), but it mentions a "fixme" that does not exist. We delete the nonsense part.
Now that libgiac is being used for "giac" integrals, one test is printing out "No checks were made for singular points of antiderivative -1/sageVARx for definite integration in [1,+infinity]" where previously the test was silent. We now "..." the junk away.
2be5a18
to
09572b1
Compare
If someone has a moment, I lost my reviewer. This adds the final set of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as far as I can judge.
Thanks, I might finally be able to pull sage.libs.giac out into a separate package now (if the GCC 15 bugs ever end). |
…tion While working on sagemath#38668, I noticed that all of our examples that use giac for integration do so with `algorithm='giac'`. This uses the pexpect interface that is much slower (and simply sloppier) than the library interface that would be used with `algorithm='libgiac'`. To fix this, I could just change those examples to `algorithm='libgiac'`, but since the libgiac interface is better in every way, that seems kind of rude to me. Most users aren't going to know what lib-anything is, and if they just want to use giac, they're going to try `algorithm='giac'`. So instead this PR makes `algorithm='giac'` do the right thing, and use the better interface. I've left the `algorithm='libgiac'` alone for now to avoid breaking any code. Afterwards I have removed the pexpect giac integrator entirely, because there's no reason to use it, and no other code in sagelib uses it. URL: sagemath#38686 Reported by: Michael Orlitzky Reviewer(s): Dima Pasechnik, Tobias Diez
…tion While working on sagemath#38668, I noticed that all of our examples that use giac for integration do so with `algorithm='giac'`. This uses the pexpect interface that is much slower (and simply sloppier) than the library interface that would be used with `algorithm='libgiac'`. To fix this, I could just change those examples to `algorithm='libgiac'`, but since the libgiac interface is better in every way, that seems kind of rude to me. Most users aren't going to know what lib-anything is, and if they just want to use giac, they're going to try `algorithm='giac'`. So instead this PR makes `algorithm='giac'` do the right thing, and use the better interface. I've left the `algorithm='libgiac'` alone for now to avoid breaking any code. Afterwards I have removed the pexpect giac integrator entirely, because there's no reason to use it, and no other code in sagelib uses it. URL: sagemath#38686 Reported by: Michael Orlitzky Reviewer(s): Dima Pasechnik, Tobias Diez
While working on #38668, I noticed that all of our examples that use giac for integration do so with
algorithm='giac'
. This uses the pexpect interface that is much slower (and simply sloppier) than the library interface that would be used withalgorithm='libgiac'
.To fix this, I could just change those examples to
algorithm='libgiac'
, but since the libgiac interface is better in every way, that seems kind of rude to me. Most users aren't going to know what lib-anything is, and if they just want to use giac, they're going to tryalgorithm='giac'
. So instead this PR makesalgorithm='giac'
do the right thing, and use the better interface. I've left thealgorithm='libgiac'
alone for now to avoid breaking any code.Afterwards I have removed the pexpect giac integrator entirely, because there's no reason to use it, and no other code in sagelib uses it.