3 Commits
Author SHA1 Message Date
tiutriumov.sm 71802c8430 Merge branch 'new_features' into 'master'
New features

See merge request tiutriumov.sm/task1-2!1
2024-03-31 21:20:16 +00:00
tiutriumov.sm 830e0a0791 tests are done 2024-03-31 22:13:18 +03:00
tiutriumov.sm e1449cb649 . 2024-03-31 21:44:11 +03:00
6 changed files with 29 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
This is the library which designation is to implement some math functions
Binary file not shown.
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
def factorial(x):
ans = 1
if x < 0:
raise ValueError('x must be greater than 0')
for i in range(1, x+1):
ans *= i
return ans
+9
View File
@@ -0,0 +1,9 @@
from trigonometry import sin
import math
pi = math.pi
print('pi:', pi)
for alpha in [0, pi, pi/2, pi/3, pi/4, pi/6]:
print(f'For angle: {0 if alpha == 0 else "pi/"+str(int(pi/alpha))}, Sin is ~ {sin(alpha)}')
#    print(f'For angle: {0 if alpha == 0 else "pi/"+str(int(pi/alpha))}, Sine  is ~ {sin(alpha)}')
+6
View File
@@ -0,0 +1,6 @@
from factorial import factorial as fct
def sin(x):
sin = 1 - (x**2/fct(2)) + (x**4/fct(4)) - (x**6/fct(6)) + (x**8/fct(8)) - (x**10/fct(10))
return round(sin, 5)