diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..b5846df --- /dev/null +++ b/Pipfile @@ -0,0 +1,11 @@ +[[source]] +name = "pypi" +url = "https://pypi.org/simple" +verify_ssl = true + +[dev-packages] + +[packages] + +[requires] +python_version = "3.8" diff --git a/README.md b/README.md index 46f9eea..cb1124f 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ -# Tprogramming_184_2020 \ No newline at end of file +# Tprogramming_184_2020 + +## Valeria Kosyh \ No newline at end of file diff --git a/hello.py b/hello.py new file mode 100644 index 0000000..06d272b --- /dev/null +++ b/hello.py @@ -0,0 +1,47 @@ +import matplotlib.pyplot as plt +import math + +def calc(a, b, x): + numerator = math.acos(x**2 - b**2) + denomerator = math.asin(x**2 - a**2) + y = numerator/denomerator + + return y + +def task_a(a, b, xn, xk, dx): + x = xn + res = [] + + while x <= xk: + y = calc(a, b, x) + res.append((x, y)) + x += dx + + return res + +def task_b(a, b, x_arr): + res = [] + + for x in x_arr: + y = calc(a, b, x) + res.append((x, y)) + + return res + +if __name__ == "__main__" : + a = 0.05 + b = 0.06 + x = 0.2 + + a_res = task_a(a, b, 0.2, 0.95, 0.15) + form_a_res = ['%.2f' % x[0] for x in a_res] + print(*form_a_res, sep=' ') + + x_arr = [0.15, 0.26, 0.37, 0.48, 0.56] + b_res = task_b(a, b, x_arr) + form_b_res = ['%.2f' % x[0] for x in b_res] + print(*form_b_res, sep=' ') + + plt.plot(*zip(*a_res), 'b') + plt.plot(*zip(*b_res), 'r') + plt.show() \ No newline at end of file