mathutilslib 0.0.1__tar.gz → 0.0.2a0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: mathutilslib
3
+ Version: 0.0.2a0
4
+ Summary: May work on 2.4, when tested it will update!
5
+ Requires-Python: >=2.7
@@ -0,0 +1,120 @@
1
+ __version__ = "0.0.1"
2
+
3
+ def Unimplemented():
4
+ raise RuntimeError("Unimplemented yet!")
5
+ def factorial(n):
6
+ if n < 0:
7
+ raise ValueError("factorial is only defined for n >= 0")
8
+
9
+ result = 1
10
+
11
+ while n > 1:
12
+ result *= n
13
+ n -= 1
14
+
15
+ return result
16
+
17
+
18
+ def double_factorial(n):
19
+ if n < 0:
20
+ raise ValueError("double factorial is only defined for n >= 0")
21
+
22
+ result = 1
23
+
24
+ while n > 1:
25
+ result *= n
26
+ n -= 2
27
+
28
+ return result
29
+
30
+
31
+ def subfactorial(n):
32
+ if n < 0:
33
+ raise ValueError("subfactorial is only defined for n >= 0")
34
+
35
+ if n == 0:
36
+ return 1
37
+
38
+ if n == 1:
39
+ return 0
40
+
41
+ a = 1 # !0
42
+ b = 0 # !1
43
+
44
+ i = 2
45
+
46
+ while i <= n:
47
+ c = (i - 1) * (a + b)
48
+ a = b
49
+ b = c
50
+ i += 1
51
+
52
+ return b
53
+
54
+
55
+ def tetration(a, n):
56
+ if n < 0:
57
+ raise ValueError("tetration height must be >= 0")
58
+
59
+ if n == 0:
60
+ return 1
61
+
62
+ result = a
63
+
64
+ i = 1
65
+
66
+ while i < n:
67
+ result = a ** result
68
+ i += 1
69
+
70
+ return result
71
+
72
+ def isNegative(a):
73
+ return a<0
74
+
75
+ def SwapPolarity(a):
76
+ return a*-1
77
+
78
+ def abs(a):
79
+ if a < 0:
80
+ return a*-1
81
+ return a
82
+
83
+ def DoNegative(a):
84
+ return eval("((a * -1) " + op + " b) * -1")
85
+
86
+ def DoNegativeFunc(a, f):
87
+ if isNegative(a):
88
+ return f(a*-1)*-1
89
+ return f(a)
90
+
91
+
92
+ def abs_add(a,b):
93
+ if a < 0:
94
+ return a - b
95
+ return a + b
96
+
97
+ def abs_sub(a,b):
98
+ if a < 0:
99
+ return a + b
100
+ return a - b
101
+
102
+ def abs_mul(a,b):
103
+ if a < 0:
104
+ return ((a*-1)*b)*-1
105
+ return a*b
106
+
107
+ def abs_div(a,b):
108
+ if isNegative(a):
109
+ return ((a*-1)*b)*-1
110
+ return a/b
111
+
112
+ def abs_pow(a,b):
113
+ if isNegative(a):
114
+ return DoNegative(a,b,"**")
115
+ return a**b
116
+
117
+ def abs_factorial(a):
118
+ if isNegative(a):
119
+ return DoNegativeFunc(a, factorial)
120
+ return factorial(a)
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: mathutilslib
3
+ Version: 0.0.2a0
4
+ Summary: May work on 2.4, when tested it will update!
5
+ Requires-Python: >=2.7
@@ -4,5 +4,6 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mathutilslib"
7
- version = "0.0.1"
8
- description = "Simple math utilities"
7
+ version = "0.0.2a"
8
+ description = "May work on 2.4, when tested it will update!"
9
+ requires-python = ">=2.7"
@@ -1,4 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: mathutilslib
3
- Version: 0.0.1
4
- Summary: Simple math utilities
@@ -1,13 +0,0 @@
1
- __version__ = "0.0.1"
2
-
3
- def add(a, b):
4
- return a + b
5
-
6
- def subtract(a, b):
7
- return a - b
8
-
9
- def multiply(a, b):
10
- return a * b
11
-
12
- def divide(a, b):
13
- return a / b
@@ -1,4 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: mathutilslib
3
- Version: 0.0.1
4
- Summary: Simple math utilities
File without changes
File without changes