Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Integral(v,t).doit() differs from integrate(v,t) #10567
Integrating a vector (v=sympy.Matrix([a*t,b,c]) shall give again a vector as a result. Sympy.integrate(v,t) gives the correct answer, however sympy.Integral(v,t) gives a completely different result:
See it also in the sympy online shell:
Hi. I managed to find something, that maybe of use for this.
If you see Line No 746 in sympy/integrals.py -
Now, If you notice the above output, which actually explains the output you get for the 4th and 5th line of your code. This happens because, in the source code, the argument function that is passed to integrate, is only checked if it's a polynomial or not, and it isn't checked for Matrix.
Although I don't understand how the the 1st line of my output (that is above) came, even though when the same functions are executed in case of integral() or Integrate()?
So, could someone help me build on this?
Hi @ashutoshsaboo, thanks for looking into this. It seems, that the Integral.doit() function is taking the input Matrix as a set of coefficients of a polynomial. But why it can be different for Integral and integrate(), if integrate (line 1230 of integrals.py) just calls Integral.doit():
@skirpichev The position where you have placed the isinstance of Matrix is I feel wrong, because it must always first check for the zero condition and the deep condition as well, and then only proceed to the condition of Matrix, otherwise in some special case your code, will give a problem.
I looked into the problem that I noticed yesterday, which I pointed above more, and as @jksuom said, the xthreaded thing is the one which is causing the problem.
Henceforth, I am opening a new pull request with the new code, that solves this issue. Please look into it @asmeurer @jksuom . Suggest in case if any other edits in the code are required, and if it can be merged into the master?