From 5eb8cb5797a3c719c4408c5d33b4932a9c5e2110 Mon Sep 17 00:00:00 2001 From: leobr Date: Thu, 20 Oct 2022 16:28:04 +0200 Subject: [PATCH] continued with task 4 --- Schenk_Brandenberger_S3_Aufg4.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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()