Open b7a46a19-303e-4ecf-84fd-1c9426f587e4 opened 3 years ago
Attachment: derivative of symbolic integration with Infinity limit fails.ipynb.gz
Attachment: derivative of symbolic integration with Infinity limit fail fixed.ipynb.gz
New commits:
c5dce36 | Trac #32184: derivative of symbolic integration with Infinity limit fails |
Commit: c5dce36
Using this commit I have successful derivative of symbolic integration with Infinity limit
sage: f.diff(y)
16*integrate((2*(x - floor(x))^3 - 3*(x - floor(x))^2 + x - floor(x))*(10*x^3*y/(x^2 + y^2)^6 - 3*x*y/(x^2 + y^2)^5), x, 1, +Infinity)
Author: Alexey Drozdov
Needs doctests - https://www.sagemath.org/git-developer-guide/coding_basics.html#writing-testable-examples
Branch pushed to git repo; I updated commit sha1. New commits:
42fccb2 | Trac: #32184 testable example added |
I don't know this code very well, but I would suggest replacing b.diff(diff_param) != 0
by not b.diff(diff_param).is_trivial_zero()
if that already fixes the example.
Also this markup
+ :trac:`32184 fixed::
+ sage: x,y = var("x,y")
is not correct, there needs to be a backquote after the ticket number and an empty line after ::
. Best to build the HTML documentation and inspect the output to make sure it is OK.
Branch pushed to git repo; I updated commit sha1. New commits:
c1f1d15 | Trac: #32184 testable example fixed |
Branch pushed to git repo; I updated commit sha1. New commits:
78e4c1e | Trac: #32184 replacing b.diff(diff_param) != 0 by not b.diff(diff_param).is_trivial_zero() fixes the example |
The HTML documentation is OK now too
With this version I am getting:
Trying (line 308): f.diff(y)
Expecting:
16*integrate((2*(x - floor(x))^3 - 3*(x - floor(x))^2 + x - floor(x))*(10*x^3*y/(x^2 + y^2)^6 - 3*x*y/(x^2 + y^2)^5), x, 1, +Infinity)
**********************************************************************
File "src/sage/symbolic/integration/integral.py", line 308, in sage.symbolic.integration.integral.DefiniteIntegral._tderivative_
Failed example:
f.diff(y)
Expected:
16*integrate((2*(x - floor(x))^3 - 3*(x - floor(x))^2 + x - floor(x))*(10*x^3*y/(x^2 + y^2)^6 - 3*x*y/(x^2 + y^2)^5), x, 1, +Infinity)
Got:
16*y*(integrate(14*x^6/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-6*x^4*y^2/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-42*x^5*floor(x)/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(18*x^3*y^2*floor(x)/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(42*x^4*floor(x)^2/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-18*x^2*y^2*floor(x)^2/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-14*x^3*floor(x)^3/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(6*x*y^2*floor(x)^3/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-21*x^5/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(9*x^3*y^2/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(42*x^4*floor(x)/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-18*x^2*y^2*floor(x)/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-21*x^3*floor(x)^2/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(9*x*y^2*floor(x)^2/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(7*x^4/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-3*x^2*y^2/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-7*x^3*floor(x)/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(3*x*y^2*floor(x)/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity))
Reviewer: Matthias Koeppe
Hi, Matthias Koeppe! you have very strange result as for me: on my code stack I have
./sage -t --long src/sage/symbolic/integration/integral.py
too few successful tests, not using stored timings
Running doctests with ID 2021-07-26-13-15-25-32b680b2.
Git branch: t/32184/derivative_of_symbolic_integration_with_infinity_limit_fails
Using --optional=build,debian,dochtml,pip,sage,sage_spkg
Doctesting 1 file.
sage -t --long --random-seed=0 src/sage/symbolic/integration/integral.py
[221 tests, 33.23 s]
----------------------------------------------------------------------
All tests passed!
Interesting, can you provide your git status and git log (for example in the attachment). Thanks
Attachment: track_32184_git_status.txt
A patchbot confirms the error in comment:14, so the ticket needs work, not review. The successful log that was posted seems to use 9.4b4, not the current sage version, which is 9.4rc0.
Ok, thanks gh-DaveWitteMorris
I have reproduced the issue just by merging of my current branch with develop branch
**********************************************************************
File "src/sage/symbolic/integration/integral.py", line 308, in sage.symbolic.integration.integral.DefiniteIntegral._tderivative_
Failed example:
f.diff(y)
Expected:
16*integrate((2*(x - floor(x))^3 - 3*(x - floor(x))^2 + x - floor(x))*(10*x^3*y/(x^2 + y^2)^6 - 3*x*y/(x^2 + y^2)^5), x, 1, +Infinity)
Got:
DefiniteIntegral integrator <function maxima_integrator at 0x7fc2a8ed8040>
DefiniteIntegral integrator <function giac_integrator at 0x7fc2a8ed8280>
DefiniteIntegral integrator <function sympy_integrator at 0x7fc2a8ed80d0>
16*y*(integrate(14*x^6/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-6*x^4*y^2/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-42*x^5*floor(x)/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(18*x^3*y^2*floor(x)/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(42*x^4*floor(x)^2/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-18*x^2*y^2*floor(x)^2/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-14*x^3*floor(x)^3/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(6*x*y^2*floor(x)^3/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-21*x^5/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(9*x^3*y^2/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(42*x^4*floor(x)/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-18*x^2*y^2*floor(x)/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-21*x^3*floor(x)^2/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(9*x*y^2*floor(x)^2/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(7*x^4/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-3*x^2*y^2/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(-7*x^3*floor(x)/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity) + integrate(3*x*y^2*floor(x)/(x^12 + 6*x^10*y^2 + 15*x^8*y^4 + 20*x^6*y^6 + 15*x^4*y^8 + 6*x^2*y^10 + y^12), x, 1, +Infinity))
**********************************************************************
Seems like we have new behavior of sympy_integrator in the develop branch
My investigation of git log have shown that behavior of integrator was changed in the ticket
Fix wrong selection of integrator in some cases https://github.com/sagemath/sage-prod/issues/32002
by commit
enhanced switching between integrators https://github.com/sagemath/sagetrac-mirror/commit/bd7886996829e8edcf3d0054ed579f8115f487aa
Branch pushed to git repo; I updated commit sha1. New commits:
fd5cf30 | Merge tag '9.4.rc2' into t/32184/derivative_of_symbolic_integration_with_infinity_limit_fails |
Stalled in needs_review
or needs_info
; likely won't make it into Sage 9.5.
CC: @EmmanuelCharpentier @slel @mkoeppe
Component: symbolics
Author: Alexey Drozdov
Branch/Commit: u/gh-daju1/derivative_of_symbolic_integration_with_infinity_limit_fails @
fd5cf30
Reviewer: Matthias Koeppe
Issue created by migration from https://trac.sagemath.org/ticket/32184