From 803ad8603846f576d9b26e06fe39a9e8d23e3e08 Mon Sep 17 00:00:00 2001 From: "WORKSTATION\\maric_000" Date: Sat, 28 Dec 2024 14:06:43 +0200 Subject: [PATCH 1/3] 3.3 lab --- Conditions/3.3.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Conditions/3.3.py diff --git a/Conditions/3.3.py b/Conditions/3.3.py new file mode 100644 index 0000000..c52138e --- /dev/null +++ b/Conditions/3.3.py @@ -0,0 +1,20 @@ +import math + +X = float(input('X = ')) +R = float(input('R = ')) + +if X <= -R: + Y = R +else: + if -R < X <= 0: + Y = -(1/2)*X + else: + if 0 < X <= R: + Y = R - math.sqrt(R**2 - X**2) + else: + if R < X <= 6: + Y = math.sqrt((R)**2 - (X - R)**2) + else: + Y = - ((X - 2*R)/(6 - 2*R)) + +print(Y) \ No newline at end of file From 02287fd479430d93c8b8b7e5149393802d204383 Mon Sep 17 00:00:00 2001 From: "WORKSTATION\\maric_000" Date: Sat, 28 Dec 2024 14:15:20 +0200 Subject: [PATCH 2/3] +2 form --- Conditions/3.3.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Conditions/3.3.py b/Conditions/3.3.py index c52138e..71277e3 100644 --- a/Conditions/3.3.py +++ b/Conditions/3.3.py @@ -17,4 +17,16 @@ else: Y = - ((X - 2*R)/(6 - 2*R)) -print(Y) \ No newline at end of file +if X <= -R: + Y2 = R +elif -R < X <= 0: + Y2 = -(1/2)*X +elif 0 < X <= R: + Y2 = R - math.sqrt(R**2 - X**2) +elif R < X <= 6: + Y2 = math.sqrt((R)**2 - (X - R)**2) +else: + Y2 = - ((X - 2*R)/(6 - 2*R)) + +print(Y) +print(Y2) \ No newline at end of file From 23f88d5ee0e4e779f4ce3c907c0aab593d29f0b4 Mon Sep 17 00:00:00 2001 From: "WORKSTATION\\maric_000" Date: Sat, 28 Dec 2024 19:19:37 +0200 Subject: [PATCH 3/3] 3.3 lad complated --- Conditions/3.3.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Conditions/3.3.py b/Conditions/3.3.py index 71277e3..c52138e 100644 --- a/Conditions/3.3.py +++ b/Conditions/3.3.py @@ -17,16 +17,4 @@ else: Y = - ((X - 2*R)/(6 - 2*R)) -if X <= -R: - Y2 = R -elif -R < X <= 0: - Y2 = -(1/2)*X -elif 0 < X <= R: - Y2 = R - math.sqrt(R**2 - X**2) -elif R < X <= 6: - Y2 = math.sqrt((R)**2 - (X - R)**2) -else: - Y2 = - ((X - 2*R)/(6 - 2*R)) - -print(Y) -print(Y2) \ No newline at end of file +print(Y) \ No newline at end of file