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
Fixing integral subs #2390
Fixing integral subs #2390
Conversation
SymPy Bot Summary: 🔴 Failed after merging Manoj-Kumar-S/Integralfix (aaa1eab) into master (90fc660). |
@asmeurer : Could you review this? There are a lot of test failures. |
First, please add tests for the new behavior, so that I can easily see what it does and verify that it is correct. |
@asmeurer : I added tests. Could you have a look now? |
assert eq.subs(y, x) == Integral(f(y), (y, x)) | ||
eq = Integral(f(x), (y, 1, 2)) | ||
assert eq.subs(y, x) == Integral(f(x), (x, 1, 2)) | ||
expr = Integral(x**log(x)*exp(x)) |
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.
Include the integration variable.
Add tests for substituting against integrals with only the upper limit. |
I think it would be better to do the substitution so that it results in a definite integral again if possible. So for example |
@asmeurer : And that would be possible only if the transformation is linear right? |
I disagree with most of the tests here. The only test that makes sense to me is
|
f = Function("f") | ||
g = Function("g") | ||
eq = Integral(f(y), y) | ||
assert eq.subs(f(y), g(y)) == Integral(g(y), y) |
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.
I don't think "eq.subs" is the function that's supposed to do this. My under is that subs is supposed to preserve mathematical equality, and this doesn't.
@manoj-kumar-s I think it would be fine if it only worked for |
You should also add tests for multiple integrals, especially multiple integrals of varying types (definite and indefinite). Let's also make sure that it works correctly for things like |
@jrioux @zanzibar7 thanks for helping review this. @raoulb we discussed this issue a few times on IRC. Do you want to help out here as well? |
@jrioux , @zanzibar7 , @asmeurer : I'm still a bit confused. So do you mean to say only this should work?
and what to do abput stuff like and for a definite integral say |
So that means bascially subs should work for a definite integral only when the |
Okay, I'm preparing a gist of rules that have to be followed, so that I can become clear. |
@jrioux , @zanzibar7 , @asmeurer : Could you please have a look at this, and say if my interpretation is right? https://gist.github.com/Manoj-Kumar-S/6277258 |
I disagree with your point 1: this subs should return I agree with point 2, which is what issue 3829 is about. I disagree with your point 3 and all its subpoints. Basically, anything that's bound inside I think you should concentrate on issue 3829 and nothing more, and maybe even hold off a bit, as #2198 looks in good shape to fix up the rest. |
Okay, great. |
SymPy Bot Summary: 🔴 Failed after merging Manoj-Kumar-S/Integralfix (95bf661) into master (905dd3e). |
But isn't |
Manoj, maybe move that to the wiki, so that we can edit it. |
Logic for things like |
@asmeurer Is anyone working on this right now, in a simultaneous PR. I don't think I have the bandwidth to work on this right now. So closing. |
First attempt at fixing integral subs.