-
Notifications
You must be signed in to change notification settings - Fork 33
Neville #88
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
base: master
Are you sure you want to change the base?
Neville #88
Conversation
|
NevillePoint |
|
NevilleInterpolation |
|
Closes #88 |
radusqrt
left a comment
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.
also, change tab to 2 spaces everywhere
| from NevillePoint import nevillepoint | ||
|
|
||
|
|
||
| # [USES] interpolations/NevillePoint |
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.
Nu mai e nevoie de asta; delete line
| import numpy as np | ||
| import matplotlib.pyplot as plt | ||
| from NevillePoint import nevillepoint | ||
|
|
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.
delete blank line
| # Function that calculates the Neville interpolation polynomial for a vector | ||
| # of points (a, b) with a:xs, b:ys in "elements" points between the first of xs | ||
| # and the last of xs; it also plots the interpolation | ||
| def nevilleinterpolation(xs, ys, elements=100): |
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.
nevilleinterpolation -> NevilleInterpolation, please
|
|
||
| for i in range(0, len(xss)): | ||
| # Calculate the approximation of the function in xss(i) | ||
| yss.append(nevillepoint(0, n - 1, xss[i], xs, ys)) |
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.
yss = []
for i in range(0, len(xss)):
# Calculate the approximation of the function in xss(i)
yss.append(nevillepoint(0, n - 1, xss[i], xs, ys))
change to
yss = [NevillePoint(0, n - 1, x, xs, ys) for x in xss]
| for i in range(0, len(xss)): | ||
| # Calculate the approximation of the function in xss(i) | ||
| yss.append(nevillepoint(0, n - 1, xss[i], xs, ys)) | ||
|
|
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.
leave only one blank line
|
|
||
|
|
||
|
|
||
| print(yss) |
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.
delete line
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.
For Python you can use YAPF[1] for automated code formatting - it is based on building the AST of the program and then printing it out directly in the proper format.
Furthermore, for coding conventions (such as how variables should be named) which are harder to fix automatically (because of Python’s dynamic nature), it is still possible to use something like Pylint[2] or Flake8[3] in order to enforce conventions.
Examples of how to configure these tools can also be found in the yapf repo[1], by looking at the proper configuration files (e.g., .style.yapf or pylintrc).
[1] https://github.com/google/yapf
[2] https://www.pylint.org/
[3] http://flake8.pycqa.org/en/latest/
| # system) | ||
|
|
||
|
|
||
| def nevillepoint(i, j, x, xs, ys): |
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.
nevillepoint -> NevillePoint
No description provided.