Skip to content
Snippets Groups Projects
Commit 22ff140d authored by jonas.stirnema's avatar jonas.stirnema
Browse files

Removed modulo from evaluate and added poorly working plot

parent 4c45e872
Branches
No related tags found
1 merge request!14Draft: Resolve "Create plot function"
......@@ -45,5 +45,18 @@ class polynome():
# Using horner method
res = 0
for i in range(len(self.coefs) - 1, -1, -1):
res = (res * x + self.coefs[i]) % self.prime_mod
res = (res * x + self.coefs[i])
return res
def plot(self):
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(-100, 100, 0.001)
y = [self.evaluate(i) for i in x]
# print(f"{x=}")
# print(f"{y=}")
print(self.evaluate(-1.9))
plt.plot(x, y)
plt.show()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment