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

Small improvement of function interpolate with single value #178

Open
natema opened this issue Nov 20, 2022 · 1 comment
Open

Small improvement of function interpolate with single value #178

natema opened this issue Nov 20, 2022 · 1 comment
Labels
improvement Improve existing code

Comments

@natema
Copy link
Member

natema commented Nov 20, 2022

interpolate(x, x₁, xₙ, y₁, yₙ) = y₁ + (x - x₁) * ((yₙ - y₁) / (xₙ - x₁))

I suggest to rename $x_n$ and $y_n$ as $x_2$ and $y_2$ to emphasize that it's just a line, and to typize the arguments (Number?)

@paulobruno
Copy link
Collaborator

I agree with $x_n \to x_2$ and $y_n \to y_2$.
But I would not sacrifice the readability of the function to explicit the type unless it's needed.

@paulobruno paulobruno added the improvement Improve existing code label Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improve existing code
Projects
None yet
Development

No branches or pull requests

2 participants