Solved Task 2a
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
#Aufgabe 2a
|
# Aufgabe 2a
|
||||||
xmin = 1.99
|
xmin = 1.99
|
||||||
xmax = 2.01
|
xmax = 2.01
|
||||||
x_number_of_points = 500
|
x_number_of_points = 500
|
||||||
@@ -18,10 +18,14 @@ for x_value in x:
|
|||||||
yg = np.append(yg, g(x_value))
|
yg = np.append(yg, g(x_value))
|
||||||
plt.plot(x, yf)
|
plt.plot(x, yf)
|
||||||
plt.plot(x, yg)
|
plt.plot(x, yg)
|
||||||
|
plt.legend(["f(x)", "g(x)"])
|
||||||
plt.show()
|
plt.show()
|
||||||
print("min f: ", min(yf), "max f: ", max(yf))
|
print("min f: ", min(yf), "max f: ", max(yf))
|
||||||
print("min g: ", min(yg), "max g: ", max(yg))
|
print("min g: ", min(yg), "max g: ", max(yg))
|
||||||
|
|
||||||
#Die Werte sind sehr klein (von e-14 bis e-12)
|
# Die Werte sind sehr klein (von -e-14 bis e-14)
|
||||||
# sodass Rundungsfehler entstehen wenn die Werte als Fliesskommazahlen
|
# sodass Rundungsfehler entstehen wenn die Werte als Fliesskommazahlen
|
||||||
# zwischengespeichert werden.
|
# zwischengespeichert werden. In den zwei Funktionen f und g werden die
|
||||||
|
# Rechenoperationen in einer anderen Reihenfolge ausgeführt
|
||||||
|
|
||||||
|
# Aufgabe 2b
|
||||||
|
|||||||
Reference in New Issue
Block a user