-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalculator3.py
89 lines (63 loc) · 1.54 KB
/
Calculator3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
n=8
def hfactorial(n):
s=1;
for j in range(1,n+1):
s=s*j
return s
def hsin(x):
return x-x*x*x/6+x*x*x*x*x/120-x*x*x*x*x*x*x/5040;
def hcos(x):
return 1-x*x/2+1/24*x*x*x*x-x*x*x*x*x*x/720;
def htan(x):
return x+x*x*x/3+2/15*x*x*x*x*x+17/315*x*x*x*x*x*x*x+62/2035*x*x*x*x*x*x*x*x*x;
def h2cos(x):
s=0.0;
for j in range(n):
s=s+(-1)**j/hfactorial(2*j)*(x**(2*j))
return s
def h2sin(x):
s=0.0;
for j in range(n):
s=s+(-1)**j/hfactorial(2*j+1)*(x**(2*j+1))
return s
def h2sinh(x):
s=0.0;
for j in range(n):
s=s+1/hfactorial(2*j+1)*(x**(2*j+1))
return s
def h2atanh(x):
s=0.0;
for j in range(1,n):
s=s+1/(2*j-1)*(x**(2*j-1))
return s
def h2atan(x):
s=0.0;
for j in range(1,n):
s=s+(-1)**(j+1)/(2*j-1)*(x**(2*j-1))
return s
def h2ln1px(x):
s=0.0;
for j in range(1,n):
s=s+(-1)**(j+1)/j*(x**(j))
return s
def h2erf(x):
s=0.0;
for j in range(1,n):
s=s+2/np.sqrt(np.pi)*(-1)**j/(2*j+1)/hfactorial(j)*(x**(2*j+1))
return s
def h2exp(x):
s=0.0;
for j in range(1,n):
s=s+1/hfactorial(j)*(x**(j))
return s
def h2acot(x):
s=0.0;
for j in range(1,n):
s=s+(-1)**j/(2*j+1)*(x**(2*j+1))
return np.pi/2-s
def h2cosh(x):
s=0.0;
for j in range(1,n):
s=s+1/hfactorial(2*j)*(x**(2*j))
return s
print(h2cos(3.14/2),h2sin(0.1),h2sinh(0.1))