PyPyNum 1.2.0__tar.gz → 1.3.1__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.
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/PKG-INFO +71 -68
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/PyPyNum.egg-info/PKG-INFO +71 -68
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/PyPyNum.egg-info/SOURCES.txt +2 -0
- PyPyNum-1.3.1/pypynum/Array.py +154 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/Geometry.py +12 -11
- PyPyNum-1.3.1/pypynum/Group.py +85 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/Matrix.py +11 -13
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/Quaternion.py +3 -3
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/README.md +68 -66
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/Vector.py +1 -13
- PyPyNum-1.3.1/pypynum/__init__.py +36 -0
- PyPyNum-1.3.1/pypynum/equations.py +14 -0
- PyPyNum-1.3.1/pypynum/file.py +69 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/plotting.py +2 -2
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/random.py +19 -14
- PyPyNum-1.3.1/pypynum/regression.py +59 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/test.py +30 -2
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/tools.py +3 -3
- PyPyNum-1.3.1/pypynum/types.py +9 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/setup.py +3 -2
- PyPyNum-1.2.0/pypynum/Array.py +0 -87
- PyPyNum-1.2.0/pypynum/__init__.py +0 -24
- PyPyNum-1.2.0/pypynum/equations.py +0 -18
- PyPyNum-1.2.0/pypynum/regression.py +0 -36
- PyPyNum-1.2.0/pypynum/types.py +0 -8
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/PyPyNum.egg-info/dependency_links.txt +0 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/PyPyNum.egg-info/top_level.txt +0 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/Logic.py +0 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/PyPyNum.png +0 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/Symbolics.py +0 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/Tensor.py +0 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/cipher.py +0 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/constants.py +0 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/errors.py +0 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/mathematics.py +0 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/neuralnetwork.py +0 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/pypynum/this.py +0 -0
- {PyPyNum-1.2.0 → PyPyNum-1.3.1}/setup.cfg +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyPyNum
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: A Python math package written in pure Python programming language
|
|
3
|
+
Version: 1.3.1
|
|
4
|
+
Summary: A Python math package written in pure Python programming language [python_requires >= 3.5]
|
|
5
5
|
Home-page: https://www.gitee.com/PythonSJL/PyPyNum
|
|
6
6
|
Author: Shen Jiayi
|
|
7
7
|
Author-email: 2261748025@qq.com
|
|
@@ -668,11 +668,28 @@ License:
|
|
|
668
668
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
669
669
|
<http://www.gnu.org/licenses/>.
|
|
670
670
|
|
|
671
|
+
Requires-Python: >=3.5
|
|
671
672
|
Description-Content-Type: text/markdown
|
|
672
673
|
|
|
673
|
-
# PyPyNum
|
|
674
|
+
# <font color = blue>PyPyNum</font>
|
|
674
675
|
|
|
675
|
-
|
|
676
|
+
<font color = gree>A Python math package written in pure Python programming language</font> <font color = red>(
|
|
677
|
+
python_requires >= 3.5)</font>
|
|
678
|
+
|
|
679
|
+
```
|
|
680
|
+
________ ___ ___ ________ ___ ___ ________ ___ ___ _____ ______
|
|
681
|
+
|\ __ \ |\ \ / /||\ __ \ |\ \ / /||\ ___ \ |\ \|\ \ |\ _ \ _ \
|
|
682
|
+
\ \ \|\ \\ \ \/ / /\ \ \|\ \\ \ \/ / /\ \ \\ \ \\ \ \\\ \\ \ \\\__\ \ \
|
|
683
|
+
\ \ ____\\ \ / / \ \ ____\\ \ / / \ \ \\ \ \\ \ \\\ \\ \ \\|__| \ \
|
|
684
|
+
\ \ \___| \/ / / \ \ \___| \/ / / \ \ \\ \ \\ \ \\\ \\ \ \ \ \ \
|
|
685
|
+
\ \__\ __/ / / \ \__\ __/ / / \ \__\\ \__\\ \_______\\ \__\ \ \__\
|
|
686
|
+
\|__| |\___/ / \|__| |\___/ / \|__| \|__| \|_______| \|__| \|__|
|
|
687
|
+
\|___|/ \|___|/
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
## Version -> 1.3.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum
|
|
691
|
+
|
|
692
|
+

|
|
676
693
|
|
|
677
694
|
### 介绍
|
|
678
695
|
|
|
@@ -707,39 +724,8 @@ Python interpreter and run it!)
|
|
|
707
724
|
|
|
708
725
|
```
|
|
709
726
|
PyPyNum
|
|
710
|
-
Logic
|
|
711
|
-
CLASSES
|
|
712
|
-
Basic
|
|
713
|
-
Binary
|
|
714
|
-
AND
|
|
715
|
-
COMP +
|
|
716
|
-
HalfAdder
|
|
717
|
-
HalfSuber +
|
|
718
|
-
JKFF +
|
|
719
|
-
NAND
|
|
720
|
-
NOR
|
|
721
|
-
OR
|
|
722
|
-
XNOR
|
|
723
|
-
XOR
|
|
724
|
-
Quaternary +
|
|
725
|
-
TwoBDiver +
|
|
726
|
-
TwoBMuler +
|
|
727
|
-
Ternary
|
|
728
|
-
FullAdder
|
|
729
|
-
FullSuber +
|
|
730
|
-
Unary
|
|
731
|
-
DFF +
|
|
732
|
-
NOT
|
|
733
|
-
TFF +
|
|
734
|
-
|
|
735
|
-
("+" indicates newly added)
|
|
736
|
-
|
|
737
|
-
PyPyNum
|
|
738
|
-
cipher
|
|
739
|
-
FUNCTIONS
|
|
740
|
-
dna(string: str, decrypt: bool = False) -> str
|
|
741
727
|
|
|
742
|
-
[
|
|
728
|
+
[Additionally, revise and supplement the original code]
|
|
743
729
|
```
|
|
744
730
|
|
|
745
731
|
### 基本结构
|
|
@@ -748,30 +734,39 @@ PyPyNum
|
|
|
748
734
|
|
|
749
735
|
```
|
|
750
736
|
PyPyNum
|
|
751
|
-
|
|
737
|
+
★ __init__
|
|
738
|
+
[Import some features from other modules in this package]
|
|
739
|
+
★ errors [Special errors]
|
|
752
740
|
CLASSES
|
|
753
741
|
LogicError
|
|
754
742
|
RandomError
|
|
755
743
|
ShapeError
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
744
|
+
★ file [Reading and saving instance data]
|
|
745
|
+
FUNCTIONS
|
|
746
|
+
read(file: str) -> list
|
|
747
|
+
write(file: str, *cls: object)
|
|
748
|
+
★ test
|
|
749
|
+
[A code test file]
|
|
750
|
+
★ this
|
|
759
751
|
[The Zen of PyPyNum]
|
|
760
|
-
types
|
|
752
|
+
★ types [Special types]
|
|
761
753
|
DATA
|
|
762
|
-
arr = list
|
|
763
|
-
ite = list
|
|
764
|
-
num = int
|
|
765
|
-
real = int
|
|
766
|
-
Array
|
|
754
|
+
arr = typing.Union[list, tuple]
|
|
755
|
+
ite = typing.Union[list, tuple, str]
|
|
756
|
+
num = typing.Union[int, float, complex]
|
|
757
|
+
real = typing.Union[int, float]
|
|
758
|
+
★ Array [N-dimensional array]
|
|
767
759
|
CLASSES
|
|
768
760
|
Array
|
|
769
761
|
FUNCTIONS
|
|
770
762
|
array(data=None)
|
|
763
|
+
fill(shape, sequence=None)
|
|
764
|
+
function(_array, _function, args=None)
|
|
765
|
+
get_shape(data)
|
|
771
766
|
is_valid_array(_array, _shape)
|
|
772
|
-
zeros(
|
|
767
|
+
zeros(shape)
|
|
773
768
|
zeros_like(_nested_list)
|
|
774
|
-
Geometry
|
|
769
|
+
★ Geometry [Planar geometry]
|
|
775
770
|
CLASSES
|
|
776
771
|
Circle
|
|
777
772
|
Line
|
|
@@ -781,7 +776,16 @@ PyPyNum
|
|
|
781
776
|
Triangle
|
|
782
777
|
FUNCTIONS
|
|
783
778
|
distance(g1, g2, error: int | float = 0) -> float
|
|
784
|
-
|
|
779
|
+
★ Group [Group theory]
|
|
780
|
+
CLASSES
|
|
781
|
+
Group
|
|
782
|
+
FUNCTIONS
|
|
783
|
+
add(x, y)
|
|
784
|
+
divide(x, y)
|
|
785
|
+
group(data)
|
|
786
|
+
multiply(x, y)
|
|
787
|
+
subtract(x, y)
|
|
788
|
+
★ Logic [Logic circuit simulation]
|
|
785
789
|
CLASSES
|
|
786
790
|
Basic
|
|
787
791
|
Binary
|
|
@@ -805,7 +809,7 @@ PyPyNum
|
|
|
805
809
|
DFF
|
|
806
810
|
NOT
|
|
807
811
|
TFF
|
|
808
|
-
Matrix
|
|
812
|
+
★ Matrix [Matrix calculation]
|
|
809
813
|
CLASSES
|
|
810
814
|
Matrix
|
|
811
815
|
FUNCTIONS
|
|
@@ -819,7 +823,7 @@ PyPyNum
|
|
|
819
823
|
tril_indices(n, k=0, m=None)
|
|
820
824
|
zeros(_dimensions)
|
|
821
825
|
zeros_like(_nested_list)
|
|
822
|
-
Quaternion
|
|
826
|
+
★ Quaternion [Quaternion calculation]
|
|
823
827
|
CLASSES
|
|
824
828
|
Euler
|
|
825
829
|
Quaternion
|
|
@@ -827,7 +831,7 @@ PyPyNum
|
|
|
827
831
|
change(data: Euler | Quaternion) -> Quaternion | Euler
|
|
828
832
|
euler(yaw: int | float = 0, pitch: int | float = 0, roll: int | float = 0) -> Euler
|
|
829
833
|
quat(w: int | float = 0, x: int | float = 0, y: int | float = 0, z: int | float = 0) -> Quaternion
|
|
830
|
-
Symbolics
|
|
834
|
+
★ Symbolics [Symbol calculation]
|
|
831
835
|
FUNCTIONS
|
|
832
836
|
interpreter(expr: str) -> list
|
|
833
837
|
DATA
|
|
@@ -836,7 +840,7 @@ PyPyNum
|
|
|
836
840
|
greek = 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟ∏ΡΣΤΥΦΧΨΩβγδεζηθικλμνξοπρστυφχψω'
|
|
837
841
|
operators = ['**', '*', '//', '/', '%', '+', '-']
|
|
838
842
|
valid = '%()*+-./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcd...yzΑΒΓΔΕΖΗΘ...'
|
|
839
|
-
Tensor
|
|
843
|
+
★ Tensor [Tensor calculation]
|
|
840
844
|
CLASSES
|
|
841
845
|
Tensor
|
|
842
846
|
FUNCTIONS
|
|
@@ -845,7 +849,7 @@ PyPyNum
|
|
|
845
849
|
tolist(_nested_list)
|
|
846
850
|
zeros(_dimensions)
|
|
847
851
|
zeros_like(_nested_list)
|
|
848
|
-
Vector
|
|
852
|
+
★ Vector [Vector calculation]
|
|
849
853
|
CLASSES
|
|
850
854
|
Vector
|
|
851
855
|
FUNCTIONS
|
|
@@ -853,10 +857,10 @@ PyPyNum
|
|
|
853
857
|
vec(data)
|
|
854
858
|
zeros(_dimensions)
|
|
855
859
|
zeros_like(_nested_list)
|
|
856
|
-
cipher
|
|
860
|
+
★ cipher [String encryption and decryption algorithms]
|
|
857
861
|
FUNCTIONS
|
|
858
862
|
dna(string: str, decrypt: bool = False) -> str
|
|
859
|
-
constants
|
|
863
|
+
★ constants [Constants in mathematics and science]
|
|
860
864
|
DATA
|
|
861
865
|
AMU = 1.6605402e-27
|
|
862
866
|
EB = 1152921504606846976
|
|
@@ -898,13 +902,11 @@ PyPyNum
|
|
|
898
902
|
yotta = 1e+24
|
|
899
903
|
zepto = 1e-21
|
|
900
904
|
zetta = 1e+21
|
|
901
|
-
equations
|
|
905
|
+
★ equations [Solving specific forms of equations]
|
|
902
906
|
FUNCTIONS
|
|
903
|
-
|
|
904
|
-
multivariate_linear_equation_system(left: list, right: list) -> None | list
|
|
905
|
-
pe = polynomial_equation(coefficients: list) -> list
|
|
907
|
+
linear_equation(left: list, right: list) -> list
|
|
906
908
|
polynomial_equation(coefficients: list) -> list
|
|
907
|
-
mathematics
|
|
909
|
+
★ mathematics [Mathematical functions]
|
|
908
910
|
FUNCTIONS
|
|
909
911
|
A = arrangement(n: int, r: int) -> int
|
|
910
912
|
C = combination(n: int, r: int) -> int
|
|
@@ -957,17 +959,17 @@ PyPyNum
|
|
|
957
959
|
tanh(x: int | float) -> int | float
|
|
958
960
|
var(numbers: list | tuple) -> int | float | complex
|
|
959
961
|
zeta(alpha: int | float) -> float
|
|
960
|
-
neuralnetwork
|
|
962
|
+
★ neuralnetwork [A simple neural network model]
|
|
961
963
|
CLASSES
|
|
962
964
|
NeuralNetwork
|
|
963
|
-
plotting
|
|
965
|
+
★ plotting [Draw a graph of equations using characters]
|
|
964
966
|
FUNCTIONS
|
|
965
967
|
background(right: int | float = 5, left: int | float = -5, top: int | float = 5, bottom: int | float = -5, complexity: int | float = 5, ratio: int | float = 3, merge: bool = False) -> list | str
|
|
966
968
|
binary(function, right: int | float = 5, left: int | float = -5, top: int | float = 5, bottom: int | float = -5, complexity: int | float = 5, ratio: int | float = 3, error=0, compare='==', merge: bool = True, basic: list = None, character: str = '.', data: bool = False) -> list | str
|
|
967
969
|
c_unary(function, start: int | float, end: int | float, interval: int | float = 5, projection: str = 'ri', right: int | float = 5, left: int | float = -5, top: int | float = 5, bottom: int | float = -5, complexity: int | float = 5, ratio: int | float = 3, merge: bool = True, basic: list = None, character: str = '.', data: bool = False) -> list | str
|
|
968
970
|
change(data: list | str) -> list | str
|
|
969
971
|
unary(function, right: int | float = 5, left: int | float = -5, top: int | float = 5, bottom: int | float = -5, complexity: int | float = 5, ratio: int | float = 3, merge: bool = True, basic: list = None, character: str = '.', data: bool = False) -> list | str
|
|
970
|
-
random
|
|
972
|
+
★ random [Generate random numbers or random arrays]
|
|
971
973
|
FUNCTIONS
|
|
972
974
|
choice(seq: list | tuple | str, shape: list | tuple = None)
|
|
973
975
|
gauss(mu: int | float = 0, sigma: int | float = 1, shape: list | tuple = None) -> float | list
|
|
@@ -975,11 +977,12 @@ PyPyNum
|
|
|
975
977
|
rand(shape: list | tuple = None) -> float | list
|
|
976
978
|
randint(a: int, b: int, shape: list | tuple = None) -> int | list
|
|
977
979
|
uniform(a: int | float, b: int | float, shape: list | tuple = None) -> float | list
|
|
978
|
-
regression
|
|
980
|
+
★ regression [Formula based polynomial regression]
|
|
979
981
|
FUNCTIONS
|
|
980
|
-
linear_regression(x, y)
|
|
981
|
-
parabolic_regression(x, y)
|
|
982
|
-
|
|
982
|
+
linear_regression(x: Union[list, tuple], y: Union[list, tuple]) -> list
|
|
983
|
+
parabolic_regression(x: Union[list, tuple], y: Union[list, tuple]) -> list
|
|
984
|
+
polynomial_regression(x: Union[list, tuple], y: Union[list, tuple], n: int = None) -> list
|
|
985
|
+
★ tools [Other useful tools]
|
|
983
986
|
FUNCTIONS
|
|
984
987
|
classify(array: list | tuple) -> dict
|
|
985
988
|
deduplicate(iterable: list | tuple | str) -> list | tuple | str
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyPyNum
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: A Python math package written in pure Python programming language
|
|
3
|
+
Version: 1.3.1
|
|
4
|
+
Summary: A Python math package written in pure Python programming language [python_requires >= 3.5]
|
|
5
5
|
Home-page: https://www.gitee.com/PythonSJL/PyPyNum
|
|
6
6
|
Author: Shen Jiayi
|
|
7
7
|
Author-email: 2261748025@qq.com
|
|
@@ -668,11 +668,28 @@ License:
|
|
|
668
668
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
669
669
|
<http://www.gnu.org/licenses/>.
|
|
670
670
|
|
|
671
|
+
Requires-Python: >=3.5
|
|
671
672
|
Description-Content-Type: text/markdown
|
|
672
673
|
|
|
673
|
-
# PyPyNum
|
|
674
|
+
# <font color = blue>PyPyNum</font>
|
|
674
675
|
|
|
675
|
-
|
|
676
|
+
<font color = gree>A Python math package written in pure Python programming language</font> <font color = red>(
|
|
677
|
+
python_requires >= 3.5)</font>
|
|
678
|
+
|
|
679
|
+
```
|
|
680
|
+
________ ___ ___ ________ ___ ___ ________ ___ ___ _____ ______
|
|
681
|
+
|\ __ \ |\ \ / /||\ __ \ |\ \ / /||\ ___ \ |\ \|\ \ |\ _ \ _ \
|
|
682
|
+
\ \ \|\ \\ \ \/ / /\ \ \|\ \\ \ \/ / /\ \ \\ \ \\ \ \\\ \\ \ \\\__\ \ \
|
|
683
|
+
\ \ ____\\ \ / / \ \ ____\\ \ / / \ \ \\ \ \\ \ \\\ \\ \ \\|__| \ \
|
|
684
|
+
\ \ \___| \/ / / \ \ \___| \/ / / \ \ \\ \ \\ \ \\\ \\ \ \ \ \ \
|
|
685
|
+
\ \__\ __/ / / \ \__\ __/ / / \ \__\\ \__\\ \_______\\ \__\ \ \__\
|
|
686
|
+
\|__| |\___/ / \|__| |\___/ / \|__| \|__| \|_______| \|__| \|__|
|
|
687
|
+
\|___|/ \|___|/
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
## Version -> 1.3.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum
|
|
691
|
+
|
|
692
|
+

|
|
676
693
|
|
|
677
694
|
### 介绍
|
|
678
695
|
|
|
@@ -707,39 +724,8 @@ Python interpreter and run it!)
|
|
|
707
724
|
|
|
708
725
|
```
|
|
709
726
|
PyPyNum
|
|
710
|
-
Logic
|
|
711
|
-
CLASSES
|
|
712
|
-
Basic
|
|
713
|
-
Binary
|
|
714
|
-
AND
|
|
715
|
-
COMP +
|
|
716
|
-
HalfAdder
|
|
717
|
-
HalfSuber +
|
|
718
|
-
JKFF +
|
|
719
|
-
NAND
|
|
720
|
-
NOR
|
|
721
|
-
OR
|
|
722
|
-
XNOR
|
|
723
|
-
XOR
|
|
724
|
-
Quaternary +
|
|
725
|
-
TwoBDiver +
|
|
726
|
-
TwoBMuler +
|
|
727
|
-
Ternary
|
|
728
|
-
FullAdder
|
|
729
|
-
FullSuber +
|
|
730
|
-
Unary
|
|
731
|
-
DFF +
|
|
732
|
-
NOT
|
|
733
|
-
TFF +
|
|
734
|
-
|
|
735
|
-
("+" indicates newly added)
|
|
736
|
-
|
|
737
|
-
PyPyNum
|
|
738
|
-
cipher
|
|
739
|
-
FUNCTIONS
|
|
740
|
-
dna(string: str, decrypt: bool = False) -> str
|
|
741
727
|
|
|
742
|
-
[
|
|
728
|
+
[Additionally, revise and supplement the original code]
|
|
743
729
|
```
|
|
744
730
|
|
|
745
731
|
### 基本结构
|
|
@@ -748,30 +734,39 @@ PyPyNum
|
|
|
748
734
|
|
|
749
735
|
```
|
|
750
736
|
PyPyNum
|
|
751
|
-
|
|
737
|
+
★ __init__
|
|
738
|
+
[Import some features from other modules in this package]
|
|
739
|
+
★ errors [Special errors]
|
|
752
740
|
CLASSES
|
|
753
741
|
LogicError
|
|
754
742
|
RandomError
|
|
755
743
|
ShapeError
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
744
|
+
★ file [Reading and saving instance data]
|
|
745
|
+
FUNCTIONS
|
|
746
|
+
read(file: str) -> list
|
|
747
|
+
write(file: str, *cls: object)
|
|
748
|
+
★ test
|
|
749
|
+
[A code test file]
|
|
750
|
+
★ this
|
|
759
751
|
[The Zen of PyPyNum]
|
|
760
|
-
types
|
|
752
|
+
★ types [Special types]
|
|
761
753
|
DATA
|
|
762
|
-
arr = list
|
|
763
|
-
ite = list
|
|
764
|
-
num = int
|
|
765
|
-
real = int
|
|
766
|
-
Array
|
|
754
|
+
arr = typing.Union[list, tuple]
|
|
755
|
+
ite = typing.Union[list, tuple, str]
|
|
756
|
+
num = typing.Union[int, float, complex]
|
|
757
|
+
real = typing.Union[int, float]
|
|
758
|
+
★ Array [N-dimensional array]
|
|
767
759
|
CLASSES
|
|
768
760
|
Array
|
|
769
761
|
FUNCTIONS
|
|
770
762
|
array(data=None)
|
|
763
|
+
fill(shape, sequence=None)
|
|
764
|
+
function(_array, _function, args=None)
|
|
765
|
+
get_shape(data)
|
|
771
766
|
is_valid_array(_array, _shape)
|
|
772
|
-
zeros(
|
|
767
|
+
zeros(shape)
|
|
773
768
|
zeros_like(_nested_list)
|
|
774
|
-
Geometry
|
|
769
|
+
★ Geometry [Planar geometry]
|
|
775
770
|
CLASSES
|
|
776
771
|
Circle
|
|
777
772
|
Line
|
|
@@ -781,7 +776,16 @@ PyPyNum
|
|
|
781
776
|
Triangle
|
|
782
777
|
FUNCTIONS
|
|
783
778
|
distance(g1, g2, error: int | float = 0) -> float
|
|
784
|
-
|
|
779
|
+
★ Group [Group theory]
|
|
780
|
+
CLASSES
|
|
781
|
+
Group
|
|
782
|
+
FUNCTIONS
|
|
783
|
+
add(x, y)
|
|
784
|
+
divide(x, y)
|
|
785
|
+
group(data)
|
|
786
|
+
multiply(x, y)
|
|
787
|
+
subtract(x, y)
|
|
788
|
+
★ Logic [Logic circuit simulation]
|
|
785
789
|
CLASSES
|
|
786
790
|
Basic
|
|
787
791
|
Binary
|
|
@@ -805,7 +809,7 @@ PyPyNum
|
|
|
805
809
|
DFF
|
|
806
810
|
NOT
|
|
807
811
|
TFF
|
|
808
|
-
Matrix
|
|
812
|
+
★ Matrix [Matrix calculation]
|
|
809
813
|
CLASSES
|
|
810
814
|
Matrix
|
|
811
815
|
FUNCTIONS
|
|
@@ -819,7 +823,7 @@ PyPyNum
|
|
|
819
823
|
tril_indices(n, k=0, m=None)
|
|
820
824
|
zeros(_dimensions)
|
|
821
825
|
zeros_like(_nested_list)
|
|
822
|
-
Quaternion
|
|
826
|
+
★ Quaternion [Quaternion calculation]
|
|
823
827
|
CLASSES
|
|
824
828
|
Euler
|
|
825
829
|
Quaternion
|
|
@@ -827,7 +831,7 @@ PyPyNum
|
|
|
827
831
|
change(data: Euler | Quaternion) -> Quaternion | Euler
|
|
828
832
|
euler(yaw: int | float = 0, pitch: int | float = 0, roll: int | float = 0) -> Euler
|
|
829
833
|
quat(w: int | float = 0, x: int | float = 0, y: int | float = 0, z: int | float = 0) -> Quaternion
|
|
830
|
-
Symbolics
|
|
834
|
+
★ Symbolics [Symbol calculation]
|
|
831
835
|
FUNCTIONS
|
|
832
836
|
interpreter(expr: str) -> list
|
|
833
837
|
DATA
|
|
@@ -836,7 +840,7 @@ PyPyNum
|
|
|
836
840
|
greek = 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟ∏ΡΣΤΥΦΧΨΩβγδεζηθικλμνξοπρστυφχψω'
|
|
837
841
|
operators = ['**', '*', '//', '/', '%', '+', '-']
|
|
838
842
|
valid = '%()*+-./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcd...yzΑΒΓΔΕΖΗΘ...'
|
|
839
|
-
Tensor
|
|
843
|
+
★ Tensor [Tensor calculation]
|
|
840
844
|
CLASSES
|
|
841
845
|
Tensor
|
|
842
846
|
FUNCTIONS
|
|
@@ -845,7 +849,7 @@ PyPyNum
|
|
|
845
849
|
tolist(_nested_list)
|
|
846
850
|
zeros(_dimensions)
|
|
847
851
|
zeros_like(_nested_list)
|
|
848
|
-
Vector
|
|
852
|
+
★ Vector [Vector calculation]
|
|
849
853
|
CLASSES
|
|
850
854
|
Vector
|
|
851
855
|
FUNCTIONS
|
|
@@ -853,10 +857,10 @@ PyPyNum
|
|
|
853
857
|
vec(data)
|
|
854
858
|
zeros(_dimensions)
|
|
855
859
|
zeros_like(_nested_list)
|
|
856
|
-
cipher
|
|
860
|
+
★ cipher [String encryption and decryption algorithms]
|
|
857
861
|
FUNCTIONS
|
|
858
862
|
dna(string: str, decrypt: bool = False) -> str
|
|
859
|
-
constants
|
|
863
|
+
★ constants [Constants in mathematics and science]
|
|
860
864
|
DATA
|
|
861
865
|
AMU = 1.6605402e-27
|
|
862
866
|
EB = 1152921504606846976
|
|
@@ -898,13 +902,11 @@ PyPyNum
|
|
|
898
902
|
yotta = 1e+24
|
|
899
903
|
zepto = 1e-21
|
|
900
904
|
zetta = 1e+21
|
|
901
|
-
equations
|
|
905
|
+
★ equations [Solving specific forms of equations]
|
|
902
906
|
FUNCTIONS
|
|
903
|
-
|
|
904
|
-
multivariate_linear_equation_system(left: list, right: list) -> None | list
|
|
905
|
-
pe = polynomial_equation(coefficients: list) -> list
|
|
907
|
+
linear_equation(left: list, right: list) -> list
|
|
906
908
|
polynomial_equation(coefficients: list) -> list
|
|
907
|
-
mathematics
|
|
909
|
+
★ mathematics [Mathematical functions]
|
|
908
910
|
FUNCTIONS
|
|
909
911
|
A = arrangement(n: int, r: int) -> int
|
|
910
912
|
C = combination(n: int, r: int) -> int
|
|
@@ -957,17 +959,17 @@ PyPyNum
|
|
|
957
959
|
tanh(x: int | float) -> int | float
|
|
958
960
|
var(numbers: list | tuple) -> int | float | complex
|
|
959
961
|
zeta(alpha: int | float) -> float
|
|
960
|
-
neuralnetwork
|
|
962
|
+
★ neuralnetwork [A simple neural network model]
|
|
961
963
|
CLASSES
|
|
962
964
|
NeuralNetwork
|
|
963
|
-
plotting
|
|
965
|
+
★ plotting [Draw a graph of equations using characters]
|
|
964
966
|
FUNCTIONS
|
|
965
967
|
background(right: int | float = 5, left: int | float = -5, top: int | float = 5, bottom: int | float = -5, complexity: int | float = 5, ratio: int | float = 3, merge: bool = False) -> list | str
|
|
966
968
|
binary(function, right: int | float = 5, left: int | float = -5, top: int | float = 5, bottom: int | float = -5, complexity: int | float = 5, ratio: int | float = 3, error=0, compare='==', merge: bool = True, basic: list = None, character: str = '.', data: bool = False) -> list | str
|
|
967
969
|
c_unary(function, start: int | float, end: int | float, interval: int | float = 5, projection: str = 'ri', right: int | float = 5, left: int | float = -5, top: int | float = 5, bottom: int | float = -5, complexity: int | float = 5, ratio: int | float = 3, merge: bool = True, basic: list = None, character: str = '.', data: bool = False) -> list | str
|
|
968
970
|
change(data: list | str) -> list | str
|
|
969
971
|
unary(function, right: int | float = 5, left: int | float = -5, top: int | float = 5, bottom: int | float = -5, complexity: int | float = 5, ratio: int | float = 3, merge: bool = True, basic: list = None, character: str = '.', data: bool = False) -> list | str
|
|
970
|
-
random
|
|
972
|
+
★ random [Generate random numbers or random arrays]
|
|
971
973
|
FUNCTIONS
|
|
972
974
|
choice(seq: list | tuple | str, shape: list | tuple = None)
|
|
973
975
|
gauss(mu: int | float = 0, sigma: int | float = 1, shape: list | tuple = None) -> float | list
|
|
@@ -975,11 +977,12 @@ PyPyNum
|
|
|
975
977
|
rand(shape: list | tuple = None) -> float | list
|
|
976
978
|
randint(a: int, b: int, shape: list | tuple = None) -> int | list
|
|
977
979
|
uniform(a: int | float, b: int | float, shape: list | tuple = None) -> float | list
|
|
978
|
-
regression
|
|
980
|
+
★ regression [Formula based polynomial regression]
|
|
979
981
|
FUNCTIONS
|
|
980
|
-
linear_regression(x, y)
|
|
981
|
-
parabolic_regression(x, y)
|
|
982
|
-
|
|
982
|
+
linear_regression(x: Union[list, tuple], y: Union[list, tuple]) -> list
|
|
983
|
+
parabolic_regression(x: Union[list, tuple], y: Union[list, tuple]) -> list
|
|
984
|
+
polynomial_regression(x: Union[list, tuple], y: Union[list, tuple], n: int = None) -> list
|
|
985
|
+
★ tools [Other useful tools]
|
|
983
986
|
FUNCTIONS
|
|
984
987
|
classify(array: list | tuple) -> dict
|
|
985
988
|
deduplicate(iterable: list | tuple | str) -> list | tuple | str
|
|
@@ -5,6 +5,7 @@ PyPyNum.egg-info/dependency_links.txt
|
|
|
5
5
|
PyPyNum.egg-info/top_level.txt
|
|
6
6
|
pypynum/Array.py
|
|
7
7
|
pypynum/Geometry.py
|
|
8
|
+
pypynum/Group.py
|
|
8
9
|
pypynum/Logic.py
|
|
9
10
|
pypynum/Matrix.py
|
|
10
11
|
pypynum/PyPyNum.png
|
|
@@ -18,6 +19,7 @@ pypynum/cipher.py
|
|
|
18
19
|
pypynum/constants.py
|
|
19
20
|
pypynum/equations.py
|
|
20
21
|
pypynum/errors.py
|
|
22
|
+
pypynum/file.py
|
|
21
23
|
pypynum/mathematics.py
|
|
22
24
|
pypynum/neuralnetwork.py
|
|
23
25
|
pypynum/plotting.py
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
from .errors import ShapeError
|
|
2
|
+
|
|
3
|
+
ArrayError = ShapeError("The shape of the array is invalid")
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Array:
|
|
7
|
+
def __init__(self, data=None, check=True):
|
|
8
|
+
if data is None:
|
|
9
|
+
data = []
|
|
10
|
+
self.shape = [] if data == [] else get_shape(data)
|
|
11
|
+
if check and self.shape and not isinstance(data, (int, float, complex)):
|
|
12
|
+
is_valid_array(data, self.shape)
|
|
13
|
+
self.data = data
|
|
14
|
+
|
|
15
|
+
def __repr__(self):
|
|
16
|
+
_type = str(type(self))
|
|
17
|
+
return _type[_type.rindex(".") + 1:-2] + "({})".format(self.data)
|
|
18
|
+
|
|
19
|
+
def __str__(self):
|
|
20
|
+
if not self.data:
|
|
21
|
+
return "[]"
|
|
22
|
+
|
|
23
|
+
def _format(_nested_list, _max_length):
|
|
24
|
+
if isinstance(_nested_list, list):
|
|
25
|
+
_copy = []
|
|
26
|
+
for item in _nested_list:
|
|
27
|
+
_copy.append(_format(item, _max_length))
|
|
28
|
+
return _copy
|
|
29
|
+
else:
|
|
30
|
+
_item = str(_nested_list)
|
|
31
|
+
return " " * (_max_length - len(_item)) + _item
|
|
32
|
+
|
|
33
|
+
_max = len(max(str(self.data).replace("[", "").replace("]", "").replace(",", "").split(), key=len))
|
|
34
|
+
_then = str(_format(self.data, _max)).replace("], ", "]\n").replace(",", "").replace("'", "").split("\n")
|
|
35
|
+
_max = max([_.count("[") for _ in _then])
|
|
36
|
+
return "\n".join([(_max - _.count("[")) * " " + _ + "\n" * (_.count("]") - 1) for _ in _then]).strip()
|
|
37
|
+
|
|
38
|
+
def __eq__(self, other):
|
|
39
|
+
return self.data == other.data
|
|
40
|
+
|
|
41
|
+
def __ne__(self, other):
|
|
42
|
+
return not self.data == other.data
|
|
43
|
+
|
|
44
|
+
def __getitem__(self, item):
|
|
45
|
+
return self.data[item]
|
|
46
|
+
|
|
47
|
+
def __round__(self, n=None):
|
|
48
|
+
return function(self, round, [n])
|
|
49
|
+
|
|
50
|
+
def __hash__(self):
|
|
51
|
+
return hash(repr(self.data))
|
|
52
|
+
|
|
53
|
+
def flatten(self):
|
|
54
|
+
data = self.data
|
|
55
|
+
while isinstance(data[0], list):
|
|
56
|
+
data = sum(data, [])
|
|
57
|
+
return data
|
|
58
|
+
|
|
59
|
+
def reshape(self, shape):
|
|
60
|
+
return type(self)(fill(shape, self.flatten()))
|
|
61
|
+
|
|
62
|
+
def copy(self):
|
|
63
|
+
from copy import deepcopy
|
|
64
|
+
return deepcopy(self)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def get_shape(data):
|
|
68
|
+
_shape = []
|
|
69
|
+
_sub = data
|
|
70
|
+
while isinstance(_sub, list):
|
|
71
|
+
_shape.append(len(_sub))
|
|
72
|
+
_sub = _sub[0]
|
|
73
|
+
return _shape
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def is_valid_array(_array, _shape):
|
|
77
|
+
if len(_shape) != 1 and not isinstance(_array, list):
|
|
78
|
+
raise ArrayError
|
|
79
|
+
if len(_shape) == 1:
|
|
80
|
+
if not isinstance(_array, list) or len(_array) != _shape[0]:
|
|
81
|
+
raise ArrayError
|
|
82
|
+
if not all(isinstance(_, (int, float, complex, Array)) for _ in _array):
|
|
83
|
+
raise TypeError("The value of the array must be a number")
|
|
84
|
+
elif len(_array) == _shape[0]:
|
|
85
|
+
for _ in _array:
|
|
86
|
+
is_valid_array(_, _shape[1:])
|
|
87
|
+
else:
|
|
88
|
+
raise ArrayError
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def array(data=None):
|
|
92
|
+
return Array(data)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def zeros(shape):
|
|
96
|
+
if len(shape) == 0:
|
|
97
|
+
return 0
|
|
98
|
+
else:
|
|
99
|
+
_array = []
|
|
100
|
+
for i in range(shape[0]):
|
|
101
|
+
_row = zeros(shape[1:])
|
|
102
|
+
_array.append(_row)
|
|
103
|
+
return _array
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def zeros_like(_nested_list):
|
|
107
|
+
if isinstance(_nested_list, list):
|
|
108
|
+
_copy = []
|
|
109
|
+
for item in _nested_list:
|
|
110
|
+
_copy.append(zeros_like(item))
|
|
111
|
+
return _copy
|
|
112
|
+
else:
|
|
113
|
+
return 0
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def fill(shape, sequence=None):
|
|
117
|
+
pointer = -1
|
|
118
|
+
length = 1
|
|
119
|
+
for item in shape:
|
|
120
|
+
length *= item
|
|
121
|
+
if sequence is None:
|
|
122
|
+
sequence = list(range(length))
|
|
123
|
+
|
|
124
|
+
def inner(_shape):
|
|
125
|
+
nonlocal pointer
|
|
126
|
+
if len(_shape) == 0:
|
|
127
|
+
pointer += 1
|
|
128
|
+
return sequence[pointer % len(sequence)]
|
|
129
|
+
else:
|
|
130
|
+
_array = []
|
|
131
|
+
for i in range(_shape[0]):
|
|
132
|
+
_row = inner(_shape[1:])
|
|
133
|
+
_array.append(_row)
|
|
134
|
+
return _array
|
|
135
|
+
|
|
136
|
+
return inner(shape)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def function(_array, _function, args=None):
|
|
140
|
+
_type = str(type(_function))
|
|
141
|
+
if not isinstance(_array, Array) or not (_type.startswith("<function ") or _type.startswith("<class ")):
|
|
142
|
+
raise TypeError("The input parameter type is incorrect")
|
|
143
|
+
data = _array.data
|
|
144
|
+
|
|
145
|
+
def inner(_array):
|
|
146
|
+
if isinstance(_array, list):
|
|
147
|
+
_copy = []
|
|
148
|
+
for item in _array:
|
|
149
|
+
_copy.append(inner(item))
|
|
150
|
+
return _copy
|
|
151
|
+
else:
|
|
152
|
+
return _function(_array) if args is None else _function(_array, *args)
|
|
153
|
+
|
|
154
|
+
return type(_array)(inner(data))
|