Skip to content
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

Series is not simplified to final answer in output in sympy 1.7.1 #20697

Closed
Shardul555 opened this issue Dec 29, 2020 · 6 comments · Fixed by #21253
Closed

Series is not simplified to final answer in output in sympy 1.7.1 #20697

Shardul555 opened this issue Dec 29, 2020 · 6 comments · Fixed by #21253
Labels

Comments

@Shardul555
Copy link

I run the code for this expression in the terminal having installed sympy version 1.7.1 but here the coefficients of y**2 and y are not simplified to final answer. Anyone guide me regarding this issue whether it is done with some purpose or this should be fixed?(Sympy live shell is giving simplified output)

>>> from sympy import *
>>> from sympy.abc import y
>>> var('p_0 p_1 p_2 p_3 b_0 b_1 b_2')
(p_0, p_1, p_2, p_3, b_0, b_1, b_2)
>>> Q = (p_0 + (p_1 + (p_2 + p_3/y)/y)/y)/(1 + ((p_3/(b_0*y) + (b_0*p_2 - b_1*p_3)/b_0**2)/y + (b_0**2*p_1 - b_0*b_1*p_2 - p_3*(b_0*b_2 - b_1**2))/b_0**3)/y)
>>> Q.series(y, n=3)
y*(b_0*p_2/p_3 + b_0*(-p_2/p_3 + b_1/b_0)) + y**2*(b_0*p_1/p_3 + b_0*p_2*(-p_2/p_3 + b_1/b_0)/p_3 + b_0*(-p_1/p_3 + (p_2/p_3 - b_1/b_0)**2 + b_1*p_2/(b_0*p_3) + b_2/b_0 - b_1**2/b_0**2)) + b_0 + O(y**3)
>>> simplify(y*(b_0*p_2/p_3 + b_0*(-p_2/p_3 + b_1/b_0)))
b_1*y
>>> simplify(y**2*(b_0*p_1/p_3 + b_0*p_2*(-p_2/p_3 + b_1/b_0)/p_3 + b_0*(-p_1/p_3 + (p_2/p_3 - b_1/b_0)**2 + b_1*p_2/(b_0*p_3) + b_2/b_0 - b_1**2/b_0**2)))
b_2*y**2

Originally posted by @Shardul555 in #9173 (comment)

@oscarbenjamin
Copy link
Contributor

Can you explain what exactly is the issue?

@Shardul555
Copy link
Author

Shardul555 commented Dec 29, 2020

This is the ouput obtained on sympy 1.7.1 version,

>>> Q.series(y, n=3)
y*(b_0*p_2/p_3 + b_0*(-p_2/p_3 + b_1/b_0)) + y**2*(b_0*p_1/p_3 + b_0*p_2*(-p_2/p_3 + b_1/b_0)/p_3 + b_0*(-p_1/p_3 + (p_2/p_3 - b_1/b_0)**2 + b_1*p_2/(b_0*p_3) + b_2/b_0 - b_1**2/b_0**2)) + b_0 + O(y**3)

This is the output obtained on sympy live shell (below),

>>> Q.series(y, n=3)
b_2*y**2 + b_1*y + b_0 + O(y**3)

I am not understanding that when on previous versions(used on sympy live shell) simplified output was obtained then why in the current release, output is not simplified to final expression.

@0sidharth
Copy link
Member

git bisect says 5dc58b7 caused this change.

@oscarbenjamin
Copy link
Contributor

CC @sachin-4099

Maybe something like ratsimp could be used with the coefficients of the series.

@sachin-4099
Copy link
Contributor

Maybe something like ratsimp could be used with the coefficients of the series.

Yeah, I guess so. Someone can try and find out the most optimal simplification method which can be used to resolve the issue.

@Shardul555
Copy link
Author

Shardul555 commented Dec 30, 2020

Ok so I will try to do it. Thanks for suggestion @oscarbenjamin @0sidharth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants