Compare commits
No commits in common. "12a91d3e0537cda263ae920d28f6c7b8cd0b6d33" and "f2506cca8e2b3ac36de5f25a191b5b80d6936700" have entirely different histories.
12a91d3e05
...
f2506cca8e
|
@ -1,27 +0,0 @@
|
||||||
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()
|
|
||||||
print("min f: ", min(yf), "max f: ", max(yf))
|
|
||||||
print("min g: ", min(yg), "max g: ", max(yg))
|
|
||||||
|
|
||||||
#Die Werte sind sehr klein (von e-14 bis e-12)
|
|
||||||
# sodass Rundungsfehler entstehen wenn die Werte als Fliesskommazahlen
|
|
||||||
# zwischengespeichert werden.
|
|
Loading…
Reference in New Issue