Skip to content

Implement Beta function - #707

Closed
abhinavagarwal07 wants to merge 15 commits into
symengine:masterfrom
abhinavagarwal07:beta-function
Closed

abhinavagarwal07 wants to merge 15 commits into
symengine:masterfrom
abhinavagarwal07:beta-function

Conversation

@abhinavagarwal07

Copy link
Copy Markdown
Contributor

Comment thread symengine/type_codes.inc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after comma.

@certik

certik commented Dec 26, 2015

Copy link
Copy Markdown
Contributor

Don't forget to add tests.

Comment thread symengine/functions.cpp Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since beta is symmetric, is it necessary to enforce the order of the arguments here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isuruf
Thanks for pointing out.
This has been solved.

@abhinavagarwal07

Copy link
Copy Markdown
Contributor Author

If I call gamma, it will redo all if statement checks like is a integer or is multiple of 2.
Though I have no other objections against it.
Also note rewrite_as_gamma is also implemented.

Comment thread symengine/functions.cpp Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you intent on both being return false ?

@abhinavagarwal07

Copy link
Copy Markdown
Contributor Author

@sumith
Sorry. I'll fix it

@sumith1896

Copy link
Copy Markdown
Contributor

Cool 😄

Comment thread symengine/eval_arb.cpp Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after Beta.

@abhinavagarwal07

Copy link
Copy Markdown
Contributor Author

@certik
ping

@abhinavagarwal07

Copy link
Copy Markdown
Contributor Author

@sumith1896
Any suggestions?

@sumith1896

Copy link
Copy Markdown
Contributor

@abhinavagarwal07 Having a look

Comment thread symengine/functions.cpp Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for ( ... ) {

@sumith1896

Copy link
Copy Markdown
Contributor

I have no much comments @abhinavagarwal07 . I think you should address Ondrej's comment above.

Comment thread symengine/functions.cpp Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should not throw an error

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If none of above 4 if's are satisfied, then how should I compare ?

@certik

certik commented Jan 3, 2016

Copy link
Copy Markdown
Contributor

@abhinavagarwal07 thanks for the PR, this will be very useful. Please ping me once you address the issues that @isuruf raised.

@isuruf

isuruf commented Jan 3, 2016

Copy link
Copy Markdown
Member

@certik, @abhinavagarwal07, what do you think about ordering the terms before creating the objects. For eg: beta(y, x) would return beta(x, y)? This way it'll be easier to write correct compare method. The other option would be to sort first before comparing.

@abhinavagarwal07

Copy link
Copy Markdown
Contributor Author

@isuruf
yes this can be done but how will you compare
β(3, 4) and β(2, 5)

@isuruf

isuruf commented Jan 3, 2016

Copy link
Copy Markdown
Member

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

@abhinavagarwal07

Copy link
Copy Markdown
Contributor Author

Ok. I will do it.

@abhinavagarwal07

Copy link
Copy Markdown
Contributor Author

@isuruf thanks for suggestions.
@isuruf @certik ping

Comment thread symengine/functions.cpp

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@certik

certik commented Jan 5, 2016

Copy link
Copy Markdown
Contributor

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.

@abhinavagarwal07

Copy link
Copy Markdown
Contributor Author

Sure.

@certik

certik commented Jan 5, 2016

Copy link
Copy Markdown
Contributor

Can you merge with the latest master (now when #738) was merged? I think you need to remove the accept method.

@abhinavagarwal07

Copy link
Copy Markdown
Contributor Author

@certik
I have merged with master.

seems like trailing whitespace check utility has failed as tests before this commits have passed
@certik

certik commented Jan 6, 2016

Copy link
Copy Markdown
Contributor

I think that this looks good. Do the tests cover all the if statements in the beta function?

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.

Comment thread symengine/functions.cpp

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need these lines anymore as the terms are ordered

@abhinavagarwal07

Copy link
Copy Markdown
Contributor Author

@abhinavagarwal07 abhinavagarwal07 mentioned this pull request Jan 7, 2016
@abhinavagarwal07

Copy link
Copy Markdown
Contributor Author

#747

@abhinavagarwal07
abhinavagarwal07 deleted the beta-function branch January 8, 2016 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants