-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Binomial coefficients are not expanded by default #1726
Conversation
It seems I'll have to do a lot of changes throughout the code so that binomial(n, r) is replaced with |
|
And it looks like many of the other failures are similar. For example, |
Yes. You're right. I was checking for binomial(1/2, 1) but not binomial(S(1)/2, 1). The former does evaluate. In any case, I'll correct the errors. |
|
Also, please add tests. |
I'll do that as soon as I can fix this. |
I've made some fixes. I believe there shouldn't be any more failed tests. If there aren't, then I'll add some tests of my own. Otherwise, it'll require more fixing. |
Fixed few errors in the doctest and added some documentation. Also, added some tests and doctests. I think things should work now. |
Good to merge? Or changes required? |
assert expand_func(binomial(n, 2)) == n*(n - 1)/2 | ||
assert expand_func(binomial(n, n - 2)) == n*(n - 1)/2 | ||
assert expand_func(binomial(n, n - 1)) == n | ||
assert binomial(n, 3) == binomial(n, 3) |
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.
Tests like this do nothing. What you should do is test that binomial(n, 3) is still an instance of binomial. The best way to do this is assert binomial(n, 3).func == binomial
.
Just those comments. Also, my bot will eventually test this, though just Travis is fine too. |
SymPy Bot Summary: 🔴 Failed after merging prasoon2211/binomial-iss3544 (10fb4a5) into master (485b303). |
Tests are failing on 3.3 because one of them took too long. |
@asmeurer I think this PR is good to merge. I has been lying around for some time now. Not trying to pester or anything .. just checking. |
SymPy Bot Summary: 🔴 Failed after merging prasoon2211/binomial-iss3544 (aba9b71) into master (485b303). |
So is it good enough to be merged? Seems that the bot is passing test for Python 3.3.0-final-0 once and failing at an other time. |
Sorry, I've been busy. Yes, this looks ok to go. |
Binomial coefficients are not expanded by default
Changes Unknown when pulling aba9b71 on prasoon2211:binomial-iss3544 into * on sympy:master*. |
Initial fix for issue 3544. Now,
Let me know if more changes are required.
I expect many tests to fail because of this change. I'll update them later.