Implement Beta function - #707
abhinavagarwal07 wants to merge 15 commits into
Conversation
There was a problem hiding this comment.
Space after comma.
|
Don't forget to add tests. |
There was a problem hiding this comment.
Since beta is symmetric, is it necessary to enforce the order of the arguments here?
There was a problem hiding this comment.
@isuruf
Thanks for pointing out.
This has been solved.
|
If I call gamma, it will redo all if statement checks like is a integer or is multiple of 2. |
There was a problem hiding this comment.
Do you intent on both being return false ?
|
@sumith |
|
Cool 😄 |
|
@certik |
|
@sumith1896 |
|
@abhinavagarwal07 Having a look |
|
I have no much comments @abhinavagarwal07 . I think you should address Ondrej's comment above. |
There was a problem hiding this comment.
This method should not throw an error
There was a problem hiding this comment.
If none of above 4 if's are satisfied, then how should I compare ?
|
@abhinavagarwal07 thanks for the PR, this will be very useful. Please ping me once you address the issues that @isuruf raised. |
|
@certik, @abhinavagarwal07, what do you think about ordering the terms before creating the objects. For eg: |
|
@isuruf |
|
Assuming the arguments are sorted, I would compare the first element of each object and return the value if they are unequal. If they are equal I will move on to the second argument |
|
Ok. I will do it. |
There was a problem hiding this comment.
This is correct, but if we call beta(y, x) then this will return false, right?
Each is_canonical check has to be enforced by the method that constructs it, in this case beta method. In it there are calls like make_rcp<const Beta>(x, y). These methods have to be changed.
For example, there is a static method called Rational::from_mpq which checks if mpq_class is an integer or not and returns Integer or Rational instance.
For Beta you need to have a method like
static RCP<const Beta> from_two_basic(const RCP<const Basic> &x, const RCP<const Basic> &y)which would call make_rcp<const Beta>(x, y) or make_rcp<const Beta>(y, x) depending on the order.
add Beta::from_two_basic
|
I would like to merge #738 first if it is ok with you. I can then help you fix any merge conflicts in this PR. |
|
Sure. |
|
Can you merge with the latest master (now when #738) was merged? I think you need to remove the |
|
@certik |
seems like trailing whitespace check utility has failed as tests before this commits have passed
|
I think that this looks good. Do the tests cover all the if statements in the Do you want to tidy the history a bit? I think you can just create a few nice commits that add the Beta function, instead of all the merges and white space fixes. I can help you with that. Submit it as a new PR, so that we have this PR for reference. |
There was a problem hiding this comment.
You don't need these lines anymore as the terms are ordered
#706