diff --git a/Schenk_Brandenberger_S3_Aufg4.py b/Schenk_Brandenberger_S3_Aufg4.py index a5afdef..2b038d6 100644 --- a/Schenk_Brandenberger_S3_Aufg4.py +++ b/Schenk_Brandenberger_S3_Aufg4.py @@ -14,7 +14,10 @@ def h1(x): return def h1_diff(x): - return (100 * x - 100) / math.sqrt(100 * math.pow(x, 2) - 200 * x + 99) + try: + return (100 * x - 100) / math.sqrt(100 * math.pow(x, 2) - 200 * x + 99) + except: + return def h2_diff(x): return (100 * x - 100) / math.sqrt((10*x-11)*(10*x-9)) @@ -24,7 +27,10 @@ def h2(x): def kondnumb(x): - return (np.abs(h1_diff(x)) * np.abs(x)) / np.abs(h1(x)) + try: + return (np.abs(h1_diff(x)) * np.abs(x)) / np.abs(h1(x)) + except: + return def kondnumb2(x): return (np.abs(h2_diff(x)) * np.abs(x)) / np.abs(h2(x)) @@ -50,7 +56,6 @@ plt.figure() plt.plot(x, y1, label='h1(x)') plt.plot(x, y2, label='h2(x)') -plt.xlim(1.099, 1.101) plt.legend() plt.show()