From 22ff140dd138551483f3a798f6ee9d87e3afa1f6 Mon Sep 17 00:00:00 2001 From: Graham <jonas.stirnemann@etu.hesge.ch> Date: Thu, 9 Dec 2021 15:35:50 +0100 Subject: [PATCH] Removed modulo from evaluate and added poorly working plot --- polynome.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/polynome.py b/polynome.py index a807c3e..0a747a7 100644 --- a/polynome.py +++ b/polynome.py @@ -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 -- GitLab