Solved Task 1.1

This commit is contained in:
schrom01 2022-09-24 19:22:58 +02:00
parent 4396381a88
commit 8f9a14e0ab
1 changed files with 5 additions and 3 deletions

View File

@ -1,15 +1,17 @@
import numpy as np import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
def fun_f(x):
return x ** 5 - 5 * x ** 4 - 30 * x ** 3 + 110 * x ** 2 + 29 * x - 105
def plot_f(xmin, xmax, xsteps): def plot_f(xmin, xmax, xsteps):
x = np.arange(xmin, xmax + xsteps, xsteps) x = np.arange(xmin, xmax + xsteps, xsteps)
f = np.array(x**5-5*x**4-30*x**3+110*x**2+29*x-105) f = np.array(fun_f(x))
plt.plot(x, f) plt.plot(x, f)
plt.xlim(-11, 11) plt.xlim(-11, 11)
plt.xticks(np.arange(min(x), max(x) + 1, 1.0)) plt.xticks(np.arange(xmin, xmax + xsteps, 1.0))
plt.ylim(-1300, 1300) plt.ylim(-1300, 1300)
plt.grid(markevery=1) plt.grid(markevery=1)
plt.show() plt.show()
plot_f(-10, 10, 0.1) #plot_f(-10, 10, 0.1)