Skip to content

Conversation

@anacalinescu
Copy link

No description provided.

@anacalinescu
Copy link
Author

NevillePoint

@anacalinescu
Copy link
Author

NevilleInterpolation

@anacalinescu anacalinescu changed the title NevillePoint Neville Oct 20, 2018
@anacalinescu
Copy link
Author

Closes #88

Copy link
Owner

@radusqrt radusqrt left a 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
Copy link
Owner

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

Copy link
Owner

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):
Copy link
Owner

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))
Copy link
Owner

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))

Copy link
Owner

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)
Copy link
Owner

Choose a reason for hiding this comment

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

delete line

Copy link

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):
Copy link
Owner

Choose a reason for hiding this comment

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

nevillepoint -> NevillePoint

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.

3 participants