Skip to content

New linear algebra algorithm#1122

Merged
cclauss merged 10 commits intoTheAlgorithms:masterfrom
nic-dern:new-lin-alg
Aug 12, 2019
Merged

New linear algebra algorithm#1122
cclauss merged 10 commits intoTheAlgorithms:masterfrom
nic-dern:new-lin-alg

Conversation

@nic-dern
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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