Solved Task 2a
This commit is contained in:
parent
f2506cca8e
commit
dd30d5e591
|
@ -0,0 +1,21 @@
|
|||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
#Aufgabe 2a
|
||||
xmin = 1.99
|
||||
xmax = 2.01
|
||||
x_number_of_points = 500
|
||||
xsteps = (xmax - xmin) / x_number_of_points
|
||||
def f(x):
|
||||
return x ** 7 - 14 * x ** 6 + 84 * x ** 5 - 280 * x ** 4 + 560 * x ** 3 - 672 * x ** 2 + 448 * x - 128
|
||||
def g(x):
|
||||
return (x - 2) ** 7
|
||||
x = np.arange(xmin, xmax + xsteps, xsteps)
|
||||
yf = np.array([])
|
||||
yg = np.array([])
|
||||
for x_value in x:
|
||||
yf = np.append(yf, f(x_value))
|
||||
yg = np.append(yg, g(x_value))
|
||||
plt.plot(x, yf)
|
||||
plt.plot(x, yg)
|
||||
plt.show()
|
Loading…
Reference in New Issue