Skip to content

New linear algebra algorithm #1122

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

Merged
merged 10 commits into from
Aug 12, 2019
Merged

New linear algebra algorithm #1122

merged 10 commits into from
Aug 12, 2019

Conversation

nic-dern
Copy link
Contributor

Hey,
I added a new linear algebra algorithm which takes a number of x and y coordinates as input and then outputs a polynomial function that connects them.
Thank you for taking a look at it.

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!! Since we are building up a library of algotithms, it would be really cool of you could create a function like def points_to_polynomial(points): that takes in some points and returns a polynomial. That will make it easier for others to move you algorithm into their own programs and will allow us to write tests for that function. Leave all the input() and print() statements outside of that function.

@cclauss
Copy link
Member

cclauss commented Aug 11, 2019

Current behavior...

python3 linear_algebra/src/python-polynom-for-points.py

The program cannot work out a fitting polynomial.
The program cannot work out a fitting polynomial.
Traceback (most recent call last):
  File "linear_algebra/src/python-polynom-for-points.py", line 107, in <module>
    print(points_to_polynomial([[1, 5], [2, 2], [3, 9]]))
  File "linear_algebra/src/python-polynom-for-points.py", line 35, in points_to_polynomial
    if check==1:
UnboundLocalError: local variable 'check' referenced before assignment

@cclauss cclauss merged commit 158b319 into TheAlgorithms:master Aug 12, 2019
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* Added new algorithm which takes points as an input and outputs a polynom connecting them

* Rename Python-Polynom-for-points.py to python-polynom-for-points.py

* Update python-polynom-for-points.py

* Update python-polynom-for-points.py

* Update python-polynom-for-points.py

* Update python-polynom-for-points.py

* Update python-polynom-for-points.py

* Update python-polynom-for-points.py

* Update python-polynom-for-points.py

* Add doctests and run thru psf/black
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.

2 participants