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

ENH: add capability to specify orders in pade func #9211

Merged
merged 4 commits into from
Sep 12, 2018

Conversation

NPDW
Copy link
Contributor

@NPDW NPDW commented Sep 3, 2018

Currently interpolate.pade only takes the order of the denominator
with the order of the numerator assumed from the order of the inputted
array . Added an optional parameter (following standard naming
convention of the pade function) which specifies the order of the
numerator. This is useful if the order of the inputted array returns
a higher order (and computationally more expensive) numerator than needed.
This change does not affect any currently written code.

Currently interpolate.pade only takes the order of the denominator <m>
with the order of the numerator assumed from the order of the inputted
array <an>. Added an optional parameter <l> (following standard naming
convention of the pade function) which specifies the order of the
numerator. This is useful if the order of the inputted array returns
a higher order (and computationally more expensive) numerator than needed.
This change does not affect any currently written code.
@NPDW
Copy link
Contributor Author

NPDW commented Sep 3, 2018

I have not yet been accepted to the scipy-dev mailing list. So I cannot discuss the change (as instructed to here https://docs.scipy.org/doc/numpy/dev/gitwash/development_workflow.html#asking-for-your-changes-to-be-merged-with-the-main-repo).

Copy link
Contributor

@hameerabbasi hameerabbasi left a comment

Choose a reason for hiding this comment

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

This looks good to me, just a minor comment.

raise ValueError("Order of q <m> must be smaller than len(an)-1.")
Akj = eye(N+1, n+1)
if N > len(an)-1:
raise ValueError("Order of q+p <m+l> must be smaller than len(an).")
Copy link
Contributor

Choose a reason for hiding this comment

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

These error messages can maybe be improved. The first one is no longer accurate.

Copy link
Contributor Author

@NPDW NPDW Sep 5, 2018

Choose a reason for hiding this comment

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

Thank you, a good point.
I left the initial error message in place for when only the parameter m is given. If both parameters are given the first error message is never called. If both parameters are given, we only care about the sum of them, hence why only warning the user about the sum.
If you think it is worthwhile, I could how much they are over by to the error message?

Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be nice if you specified the l < 0 part, what if the user themselves passes in l < 0?

@NPDW
Copy link
Contributor Author

NPDW commented Sep 5, 2018

I've added the recommended changes of checking if l<0

Copy link
Contributor

@hameerabbasi hameerabbasi left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@ev-br
Copy link
Member

ev-br commented Sep 8, 2018

Looks good modulo a standard complaint to using the lowercase l letter. Maybe change it to the lowecase n?

@ev-br ev-br added the enhancement A new feature or improvement label Sep 8, 2018
@NPDW
Copy link
Contributor Author

NPDW commented Sep 8, 2018

I changed it to l to follow convention for Pade approximant, but I understand the readability issues that come with using it. I'll revert it back.

Copy link
Member

@ev-br ev-br left a comment

Choose a reason for hiding this comment

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

LGTM modulo a minor optional comment. I'm going to leave this open for a couple of days more before hitting the green button, in case someone else wants to take a look.

The order of the returned approximating polynomial q.
n : int, optional
The order of the returned approximating polynomial p. By default,
the order is len(an)-m.
Copy link
Member

Choose a reason for hiding this comment

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

Minor, optional: can wrap code into double backticks. Ditto for p and q.

@NPDW
Copy link
Contributor Author

NPDW commented Sep 8, 2018

Since p and q are being used as mathematical variables here, I assumed that I would treat them as being inline maths, as is described in the documentation.

@hameerabbasi
Copy link
Contributor

Fair enough. +1 from me.

@ev-br ev-br merged commit efc1120 into scipy:master Sep 12, 2018
@ev-br
Copy link
Member

ev-br commented Sep 12, 2018

Backticks are still not perfect: single backticks create hyperlinks. Double backticks typeset code, inline math is :math:backtick ... backtick. Anyway, let's not hold a PR for a minor thing which can cleaned up later on.

Thanks @NPDW and congrats with what I believe is your first scipy commit. Keep them coming!

@ev-br ev-br added this to the 1.2.0 milestone Sep 12, 2018
@NPDW
Copy link
Contributor Author

NPDW commented Sep 12, 2018

Thank you Evgeni, I'm proud to now be a contributor to such a great product!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or improvement scipy.interpolate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants