Conversation
|
NevillePoint |
|
NevilleInterpolation |
|
Closes #88 |
radusqrt
left a comment
There was a problem hiding this comment.
also, change tab to 2 spaces everywhere
| from NevillePoint import nevillepoint | ||
|
|
||
|
|
||
| # [USES] interpolations/NevillePoint |
There was a problem hiding this comment.
Nu mai e nevoie de asta; delete line
| import numpy as np | ||
| import matplotlib.pyplot as plt | ||
| from NevillePoint import nevillepoint | ||
|
|
| # 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.
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.
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)) | ||
|
|
|
|
||
|
|
||
|
|
||
| print(yss) |
There was a problem hiding this comment.
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): |
No description provided.