Skip to content
Snippets Groups Projects

Draft: Resolve "Create plot function"

Closed jonas.stirnema requested to merge 15-create-plot-function into main
1 file
+ 14
1
Compare changes
  • Side-by-side
  • Inline
+ 14
1
@@ -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
Loading