PyPyNum 1.9.0__tar.gz → 1.9.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.
Files changed (43) hide show
  1. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/PKG-INFO +55 -91
  2. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/PyPyNum.egg-info/PKG-INFO +55 -91
  3. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/PyPyNum.egg-info/SOURCES.txt +1 -0
  4. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/Array.py +45 -6
  5. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/README.md +54 -90
  6. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/__init__.py +1 -1
  7. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/cipher.py +67 -0
  8. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/maths.py +30 -27
  9. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/plotting.py +10 -27
  10. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/regression.py +2 -4
  11. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/test.py +2 -3
  12. PyPyNum-1.9.1/pypynum/ufuncs.py +26 -0
  13. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/setup.py +1 -1
  14. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/PyPyNum.egg-info/dependency_links.txt +0 -0
  15. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/PyPyNum.egg-info/top_level.txt +0 -0
  16. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/FourierT.py +0 -0
  17. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/Geometry.py +0 -0
  18. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/Graph.py +0 -0
  19. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/Group.py +0 -0
  20. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/Logic.py +0 -0
  21. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/Matrix.py +0 -0
  22. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/NeuralN.py +0 -0
  23. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/PyPyNum.png +0 -0
  24. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/Quaternion.py +0 -0
  25. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/Symbolics.py +0 -0
  26. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/Tensor.py +0 -0
  27. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/Tree.py +0 -0
  28. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/Vector.py +0 -0
  29. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/chars.py +0 -0
  30. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/constants.py +0 -0
  31. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/equations.py +0 -0
  32. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/errors.py +0 -0
  33. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/file.py +0 -0
  34. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/numbers.py +0 -0
  35. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/polynomial.py +0 -0
  36. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/probability.py +0 -0
  37. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/random.py +0 -0
  38. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/sequence.py +0 -0
  39. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/this.py +0 -0
  40. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/tools.py +0 -0
  41. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/types.py +0 -0
  42. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/pypynum/utils.py +0 -0
  43. {PyPyNum-1.9.0 → PyPyNum-1.9.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyPyNum
3
- Version: 1.9.0
3
+ Version: 1.9.1
4
4
  Summary: A multifunctional mathematical calculation package written in pure Python programming language [Python>=3.4]
5
5
  Home-page: https://github.com/PythonSJL/PyPyNum
6
6
  Author: Shen Jiayi
@@ -692,7 +692,7 @@ Description-Content-Type: text/markdown
692
692
  [![Downloads](https://static.pepy.tech/badge/pypynum/month)](https://pepy.tech/project/pypynum)
693
693
  [![Downloads](https://static.pepy.tech/badge/pypynum/week)](https://pepy.tech/project/pypynum)
694
694
 
695
- ## Version -> 1.9.0 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
695
+ ## Version -> 1.9.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
696
696
 
697
697
  ![LOGO](PyPyNum.png)
698
698
 
@@ -789,61 +789,11 @@ Python interpreter and run it!
789
789
  ```
790
790
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
791
791
 
792
- 新增的代码行数约三百行。
792
+ 修复了一些功能问题
793
793
 
794
- The number of new code lines is
795
- about 300.
794
+ Fixed some functional issues
796
795
 
797
796
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
798
-
799
- 以下函数进行了改名,使用时请注意。
800
-
801
- The following functions have
802
- been renamed, please be careful
803
- when using them.
804
-
805
-
806
- interpreter -> parse_expr
807
- deduplicate -> dedup
808
- interpolation -> interp
809
-
810
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
811
-
812
- “chi2_cont”是卡方检验函数,支持输入一
813
- 个列联表,返回(chi2,p,dof,
814
- expected),当自由度为1时可以设置是否
815
- 经过Yates校正。
816
-
817
- "chi2_cont" is a chi-square
818
- test function that supports
819
- entering a contingency table and
820
- returning (chi2, p, dof,
821
- expected). When the degree of
822
- freedom is 1, you can set
823
- whether to perform Yates
824
- correction.
825
-
826
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
827
-
828
- PyPyNum
829
- ├── cipher
830
- │ └── FUNCTION
831
- │ ├── atbash(text: str) -> str
832
- │ ├── base_64(text: str, decrypt: bool) -> str
833
- │ ├── caesar(text: str, shift: int, decrypt: bool) -> str
834
- │ ├── morse(text: str, decrypt: bool) -> str
835
- │ ├── playfair(text: str, key: str, decrypt: bool) -> str
836
- │ ├── rot13(text: str) -> str
837
- │ ├── substitution(text: str, sub_map: dict, decrypt: bool) -> str
838
- │ └── vigenere(text: str, key: str, decrypt: bool) -> str
839
- ├── probability
840
- │ └── FUNCTION
841
- │ ├── chi2_cont(contingency: list, calc_p: bool, corr: bool) -> tuple
842
- │ ├── chi2_pdf(x: typing.Union[int, float], k: typing.Union[int, float]) -> float
843
- └── utils
844
- ├── CLASS
845
- │ ├── LinkedList(object)/__init__(self: Any) -> Any
846
- │ ├── LinkedListNode(object)/__init__(self: Any, value: Any, next_node: Any) -> Any
847
797
  ```
848
798
 
849
799
  ### 运行用时测试
@@ -873,7 +823,7 @@ PyPyNum
873
823
  │ │ └── Array(object)/__init__(self: Any, data: Any, check: Any) -> Any
874
824
  │ └── FUNCTION
875
825
  │ ├── array(data: Any) -> Any
876
- │ ├── fill(shape: Any, sequence: Any, repeat: Any) -> Any
826
+ │ ├── fill(shape: Any, sequence: Any, repeat: Any, pad: Any) -> Any
877
827
  │ ├── function(_array: Any, _function: Any, args: Any) -> Any
878
828
  │ ├── get_shape(data: Any) -> Any
879
829
  │ ├── is_valid_array(_array: Any, _shape: Any) -> Any
@@ -1001,8 +951,12 @@ PyPyNum
1001
951
  │ ├── atbash(text: str) -> str
1002
952
  │ ├── base_64(text: str, decrypt: bool) -> str
1003
953
  │ ├── caesar(text: str, shift: int, decrypt: bool) -> str
954
+ │ ├── hill256(text: bytes, key: list, decrypt: bool) -> bytes
955
+ │ ├── ksa(key: bytes) -> list
1004
956
  │ ├── morse(text: str, decrypt: bool) -> str
1005
957
  │ ├── playfair(text: str, key: str, decrypt: bool) -> str
958
+ │ ├── prga(s: list) -> Any
959
+ │ ├── rc4(text: bytes, key: bytes) -> bytes
1006
960
  │ ├── rot13(text: str) -> str
1007
961
  │ ├── substitution(text: str, sub_map: dict, decrypt: bool) -> str
1008
962
  │ └── vigenere(text: str, key: str, decrypt: bool) -> str
@@ -1102,7 +1056,7 @@ PyPyNum
1102
1056
  │ ├── tanh(x: typing.Union[int, float]) -> typing.Union[int, float]
1103
1057
  │ ├── totient(n: int) -> int
1104
1058
  │ ├── var(numbers: typing.Union[list, tuple], dof: int) -> typing.Union[int, float, complex]
1105
- │ └── zeta(alpha: typing.Union[int, float]) -> float
1059
+ │ └── zeta(alpha: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
1106
1060
  ├── numbers
1107
1061
  │ ├── CLASS
1108
1062
  │ └── FUNCTION
@@ -1115,7 +1069,7 @@ PyPyNum
1115
1069
  │ └── FUNCTION
1116
1070
  │ ├── background(right: typing.Union[int, float], left: typing.Union[int, float], top: typing.Union[int, float], bottom: typing.Union[int, float], complexity: typing.Union[int, float], ratio: typing.Union[int, float], string: bool) -> typing.Union[list, str]
1117
1071
  │ ├── binary(function: Any, right: typing.Union[int, float], left: typing.Union[int, float], top: typing.Union[int, float], bottom: typing.Union[int, float], complexity: typing.Union[int, float], ratio: typing.Union[int, float], error: Any, compare: Any, string: bool, basic: list, character: str, data: bool, coloration: Any) -> typing.Union[list, str]
1118
- │ ├── c_unary(function: Any, start: typing.Union[int, float], end: typing.Union[int, float], interval: typing.Union[int, float], projection: str, right: typing.Union[int, float], left: typing.Union[int, float], top: typing.Union[int, float], bottom: typing.Union[int, float], complexity: typing.Union[int, float], ratio: typing.Union[int, float], string: bool, basic: list, character: str, data: bool, coloration: Any) -> typing.Union[list, str]
1072
+ │ ├── c_unary(function: Any, projection: str, right: typing.Union[int, float], left: typing.Union[int, float], top: typing.Union[int, float], bottom: typing.Union[int, float], complexity: typing.Union[int, float], ratio: typing.Union[int, float], string: bool, basic: list, character: str, data: bool, coloration: Any) -> typing.Union[list, str]
1119
1073
  │ ├── change(data: typing.Union[list, str]) -> typing.Union[list, str]
1120
1074
  │ ├── color(text: str, rgb: typing.Union[list, tuple]) -> str
1121
1075
  │ └── unary(function: Any, right: typing.Union[int, float], left: typing.Union[int, float], top: typing.Union[int, float], bottom: typing.Union[int, float], complexity: typing.Union[int, float], ratio: typing.Union[int, float], string: bool, basic: list, character: str, data: bool, coloration: Any) -> typing.Union[list, str]
@@ -1180,6 +1134,16 @@ PyPyNum
1180
1134
  ├── types
1181
1135
  │ ├── CLASS
1182
1136
  │ └── FUNCTION
1137
+ ├── ufuncs
1138
+ │ ├── CLASS
1139
+ │ └── FUNCTION
1140
+ │ ├── add(x: Any, y: Any) -> Any
1141
+ │ ├── divide(x: Any, y: Any) -> Any
1142
+ │ ├── floor_divide(x: Any, y: Any) -> Any
1143
+ │ ├── modulo(x: Any, y: Any) -> Any
1144
+ │ ├── multiply(x: Any, y: Any) -> Any
1145
+ │ ├── power(x: Any, y: Any, m: Any) -> Any
1146
+ │ └── subtract(x: Any, y: Any) -> Any
1183
1147
  └── utils
1184
1148
  ├── CLASS
1185
1149
  │ ├── InfIterator(object)/__init__(self: Any, start: typing.Union[int, float, complex], mode: str, common: typing.Union[int, float, complex]) -> Any
@@ -1425,7 +1389,7 @@ print(maths.var([2, 3, 5, 7, 11, 13, 17, 19, 23, 29]))
1425
1389
  plt = plotting.unary(lambda x: x ** 2, top=10, bottom=0, character="+")
1426
1390
  print(plt)
1427
1391
  print(plotting.binary(lambda x, y: x ** 2 + y ** 2 - 10, right=10, left=0, compare="<=", basic=plotting.change(plt)))
1428
- print(plotting.c_unary(lambda x: x ** x, start=-10, end=10, interval=100, right=2, left=-2, top=2, bottom=-2, complexity=20, character="-"))
1392
+ print(plotting.c_unary(lambda x: x ** x, right=2, left=-2, top=2, bottom=-2, complexity=20, character="-"))
1429
1393
 
1430
1394
  """
1431
1395
  1.00e+01| + +
@@ -1466,34 +1430,34 @@ print(plotting.c_unary(lambda x: x ** x, start=-10, end=10, interval=100, right=
1466
1430
  | +++ +++
1467
1431
  0.00e+00|________________________+++________________________
1468
1432
  -5.00e+00 0.00e+00 5.00e+00
1469
- 2.00e+00|
1470
- |
1471
- |
1472
- |
1473
- |
1474
- |
1475
- |
1476
- |
1477
- |
1478
- | -------
1479
- | ------ -----
1480
- | ---- --
1481
- | --- --
1482
- 0.00e+00|_ _ _ _ _ _ _ _ _ _ --_ _ _ _ _ _ _ _ _-- _ _-- _ _ _ ---------------------------
1483
- | -- ------- ---
1484
- | - --
1485
- | - -
1486
- | -- -
1487
- | -- -
1488
- | -- -
1489
- | --- ---
1490
- | ---- ----
1491
- | -------- -------
1492
- | ------------
1493
- |
1494
- |
1495
- |
1496
- -2.00e+00|_________________________________________________________________________________
1433
+ 2.00e+00| - - - - - -
1434
+ | - - - - - - -
1435
+ | - - - - - -
1436
+ |- - - - - - -
1437
+ | - - - - -- - - - -
1438
+ | - - - - - - - - -
1439
+ | - - - - -- - --- -- - -- - - - - -
1440
+ | - - - -- -- - - - -- - - -
1441
+ | - - - - - - - -- - --- --- - - --- -- - -
1442
+ | - - - - - -- ----- -- -- --- -- -- --- -- - -
1443
+ | - - - ------------ ---- - -- -- - --- - - -
1444
+ | - - - - - ----- - -- ----------------------- -- ---- - -- --
1445
+ | - - - - - ---- --------------------------------- - - - - - -
1446
+ 0.00e+00|_ _ _ _ _ _ _ _-_-_-_-_---- ------------------------------------_-- _ _ _ _ _ _ _
1447
+ | - - - - ----------------------------------------- -- - - - -
1448
+ | - -- - - -- - - --------------------------------- - - -
1449
+ | - - ---- - - -- --------------------- ----- ---- - -- -
1450
+ | - - -- --------- -- -- - ----- --- -- - - - -
1451
+ | - - - - - - - ---- --- --- --- -- -- --- - - -
1452
+ | - - - - - -- -- -- - - -- -- --
1453
+ | - - - -- - -- -- - - -- - -
1454
+ | - - - - - - - -- - - -- - -
1455
+ | - - - - -- -- - - - - -
1456
+ | - - - - - - - -
1457
+ |- - - - - - - -
1458
+ | - - - - - -
1459
+ | - - - - -
1460
+ -2.00e+00|___________-_________________-___________-_____________________-____________-____
1497
1461
  -2.00e+00 0.00e+00 2.00e+00
1498
1462
  """
1499
1463
 
@@ -1503,10 +1467,10 @@ print(random.randint(0, 9, [2, 3, 4]))
1503
1467
  print(random.uniform(0, 9, [2, 3, 4]))
1504
1468
 
1505
1469
  """
1506
- [[[1.5224810365398622, -0.3957309179046998, 0.22865800022960608, 0.69458992002954], [1.2796914880445907, -0.9963205507196862, -1.035672172661647, 0.6685698624811087], [0.7966036403993993, 1.4728609716690575, 1.4271945372122727, 1.1346636992788732]], [[-1.5167315121066547, 0.5337355746221562, -0.3856209788535444, 0.9933311189027801], [-0.3000451683620412, 1.985371100287406, 1.0044445415210081, -0.160547602340231], [-1.4024800661532726, -0.2943388293424122, 0.39426575084974064, -0.1788920335787877]]]
1507
- [[[0.5832734051570118, 0.12709072960713108, 0.8460371711928255, 0.7732502834495745], [0.1337174418330055, 0.20214133151753821, 0.11501155244785399, 0.945090241309287], [0.784115524194132, 0.5008953798117651, 0.3514598489060844, 0.2730882163660271]], [[0.8536525608965406, 0.03101021951426164, 0.8904423549934418, 0.30844019778976395], [0.6686071112680847, 0.8622569244011669, 0.5624751157425253, 0.25138337174684133], [0.28360470724085995, 0.31597491199666694, 0.8115190344839784, 0.2685895801115009]]]
1508
- [[[7, 1, 2, 5], [0, 7, 9, 9], [3, 0, 5, 6]], [[2, 2, 4, 3], [9, 7, 2, 0], [2, 5, 6, 6]]]
1509
- [[[3.2674331705558304, 8.794845124593792, 8.48281482952606, 4.071439810303413], [3.525937325174985, 8.353244015747865, 5.167113956700689, 8.200558536323298], [0.5729366698493622, 4.49113422389227, 7.736245315815029, 1.9082811620380302]], [[4.889120931109369, 1.6037956737307013, 7.983047897048623, 1.3817112552960102], [5.866208284533167, 0.5963242816793028, 6.17792540726971, 8.415093555918986], [0.2560629015262261, 1.9094767046602064, 5.647362624435581, 4.042400239970636]]]
1470
+ [[[0.4604088962341266, -1.7729143777833498, -1.027113249139529, -1.367335972424437], [1.5152952392963814, 0.1143532276512219, -2.2478367353916626, 0.770010737736378], [-0.4126751204277065, -2.5483288418244814, -0.8493985529797649, -0.5563319772201964]], [[1.9010219123281087, 0.44289739103266357, -0.7148439667426828, -0.742966218100922], [0.21210379525283574, 1.5466635593995341, -0.4536304781981763, 0.5978046752778463], [-0.802299453332161, -1.0295309618075863, 0.5960990076298143, -0.7956578324150254]]]
1471
+ [[[0.6378288221898551, 0.5667742466043126, 0.4656215108828976, 0.15042085420645113], [0.17290475960349394, 0.7286971110875379, 0.645886619551428, 0.6328537921605502], [0.5626377160935252, 0.41015810474249603, 0.9951566294215863, 0.21679108443018347]], [[0.7747392018966252, 0.5885873225687281, 0.4305122635955937, 0.1102178686782671], [0.6823600514076231, 0.919946966200235, 0.9010988477920265, 0.9324975541841414], [0.026520946245817467, 0.7483826867189314, 0.25799134110551736, 0.7231613737350734]]]
1472
+ [[[5, 5, 4, 2], [2, 0, 9, 6], [9, 2, 0, 0]], [[0, 3, 9, 2], [2, 5, 5, 3], [9, 2, 5, 1]]]
1473
+ [[[4.661185893580614, 6.263504213542613, 1.5982048879385133, 4.592524740685044], [5.915777961319595, 0.7073727896327806, 2.6233256174392263, 4.980453415047565], [2.257336580759053, 8.299789041235444, 5.839322602213961, 3.1890466264933925]], [[8.498155134210208, 4.722625882838601, 4.4036516933236705, 4.313235000904077], [3.7418534910533126, 2.7783464437089305, 8.884554145257127, 3.860087039759355], [4.430653527343895, 0.9625175276439548, 6.813933725727357, 7.910773669181097]]]
1510
1474
  """
1511
1475
 
1512
1476
  print(regression.linear_regression(list(range(5)), [2, 4, 6, 7, 8]))
@@ -1515,7 +1479,7 @@ print(regression.polynomial_regression(list(range(5)), [2, 4, 6, 7, 8], 4))
1515
1479
 
1516
1480
  """
1517
1481
  [1.5, 2.4000000000000004]
1518
- [-0.21428571428571183, 2.3571428571428474, 1.9714285714285764]
1482
+ [-0.21428571428571563, 2.3571428571428625, 1.971428571428569]
1519
1483
  [0.08333333334800574, -0.6666666668092494, 1.4166666678382942, 1.1666666648311956, 2.0000000002900613]
1520
1484
  """
1521
1485
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyPyNum
3
- Version: 1.9.0
3
+ Version: 1.9.1
4
4
  Summary: A multifunctional mathematical calculation package written in pure Python programming language [Python>=3.4]
5
5
  Home-page: https://github.com/PythonSJL/PyPyNum
6
6
  Author: Shen Jiayi
@@ -692,7 +692,7 @@ Description-Content-Type: text/markdown
692
692
  [![Downloads](https://static.pepy.tech/badge/pypynum/month)](https://pepy.tech/project/pypynum)
693
693
  [![Downloads](https://static.pepy.tech/badge/pypynum/week)](https://pepy.tech/project/pypynum)
694
694
 
695
- ## Version -> 1.9.0 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
695
+ ## Version -> 1.9.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
696
696
 
697
697
  ![LOGO](PyPyNum.png)
698
698
 
@@ -789,61 +789,11 @@ Python interpreter and run it!
789
789
  ```
790
790
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
791
791
 
792
- 新增的代码行数约三百行。
792
+ 修复了一些功能问题
793
793
 
794
- The number of new code lines is
795
- about 300.
794
+ Fixed some functional issues
796
795
 
797
796
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
798
-
799
- 以下函数进行了改名,使用时请注意。
800
-
801
- The following functions have
802
- been renamed, please be careful
803
- when using them.
804
-
805
-
806
- interpreter -> parse_expr
807
- deduplicate -> dedup
808
- interpolation -> interp
809
-
810
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
811
-
812
- “chi2_cont”是卡方检验函数,支持输入一
813
- 个列联表,返回(chi2,p,dof,
814
- expected),当自由度为1时可以设置是否
815
- 经过Yates校正。
816
-
817
- "chi2_cont" is a chi-square
818
- test function that supports
819
- entering a contingency table and
820
- returning (chi2, p, dof,
821
- expected). When the degree of
822
- freedom is 1, you can set
823
- whether to perform Yates
824
- correction.
825
-
826
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
827
-
828
- PyPyNum
829
- ├── cipher
830
- │ └── FUNCTION
831
- │ ├── atbash(text: str) -> str
832
- │ ├── base_64(text: str, decrypt: bool) -> str
833
- │ ├── caesar(text: str, shift: int, decrypt: bool) -> str
834
- │ ├── morse(text: str, decrypt: bool) -> str
835
- │ ├── playfair(text: str, key: str, decrypt: bool) -> str
836
- │ ├── rot13(text: str) -> str
837
- │ ├── substitution(text: str, sub_map: dict, decrypt: bool) -> str
838
- │ └── vigenere(text: str, key: str, decrypt: bool) -> str
839
- ├── probability
840
- │ └── FUNCTION
841
- │ ├── chi2_cont(contingency: list, calc_p: bool, corr: bool) -> tuple
842
- │ ├── chi2_pdf(x: typing.Union[int, float], k: typing.Union[int, float]) -> float
843
- └── utils
844
- ├── CLASS
845
- │ ├── LinkedList(object)/__init__(self: Any) -> Any
846
- │ ├── LinkedListNode(object)/__init__(self: Any, value: Any, next_node: Any) -> Any
847
797
  ```
848
798
 
849
799
  ### 运行用时测试
@@ -873,7 +823,7 @@ PyPyNum
873
823
  │ │ └── Array(object)/__init__(self: Any, data: Any, check: Any) -> Any
874
824
  │ └── FUNCTION
875
825
  │ ├── array(data: Any) -> Any
876
- │ ├── fill(shape: Any, sequence: Any, repeat: Any) -> Any
826
+ │ ├── fill(shape: Any, sequence: Any, repeat: Any, pad: Any) -> Any
877
827
  │ ├── function(_array: Any, _function: Any, args: Any) -> Any
878
828
  │ ├── get_shape(data: Any) -> Any
879
829
  │ ├── is_valid_array(_array: Any, _shape: Any) -> Any
@@ -1001,8 +951,12 @@ PyPyNum
1001
951
  │ ├── atbash(text: str) -> str
1002
952
  │ ├── base_64(text: str, decrypt: bool) -> str
1003
953
  │ ├── caesar(text: str, shift: int, decrypt: bool) -> str
954
+ │ ├── hill256(text: bytes, key: list, decrypt: bool) -> bytes
955
+ │ ├── ksa(key: bytes) -> list
1004
956
  │ ├── morse(text: str, decrypt: bool) -> str
1005
957
  │ ├── playfair(text: str, key: str, decrypt: bool) -> str
958
+ │ ├── prga(s: list) -> Any
959
+ │ ├── rc4(text: bytes, key: bytes) -> bytes
1006
960
  │ ├── rot13(text: str) -> str
1007
961
  │ ├── substitution(text: str, sub_map: dict, decrypt: bool) -> str
1008
962
  │ └── vigenere(text: str, key: str, decrypt: bool) -> str
@@ -1102,7 +1056,7 @@ PyPyNum
1102
1056
  │ ├── tanh(x: typing.Union[int, float]) -> typing.Union[int, float]
1103
1057
  │ ├── totient(n: int) -> int
1104
1058
  │ ├── var(numbers: typing.Union[list, tuple], dof: int) -> typing.Union[int, float, complex]
1105
- │ └── zeta(alpha: typing.Union[int, float]) -> float
1059
+ │ └── zeta(alpha: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
1106
1060
  ├── numbers
1107
1061
  │ ├── CLASS
1108
1062
  │ └── FUNCTION
@@ -1115,7 +1069,7 @@ PyPyNum
1115
1069
  │ └── FUNCTION
1116
1070
  │ ├── background(right: typing.Union[int, float], left: typing.Union[int, float], top: typing.Union[int, float], bottom: typing.Union[int, float], complexity: typing.Union[int, float], ratio: typing.Union[int, float], string: bool) -> typing.Union[list, str]
1117
1071
  │ ├── binary(function: Any, right: typing.Union[int, float], left: typing.Union[int, float], top: typing.Union[int, float], bottom: typing.Union[int, float], complexity: typing.Union[int, float], ratio: typing.Union[int, float], error: Any, compare: Any, string: bool, basic: list, character: str, data: bool, coloration: Any) -> typing.Union[list, str]
1118
- │ ├── c_unary(function: Any, start: typing.Union[int, float], end: typing.Union[int, float], interval: typing.Union[int, float], projection: str, right: typing.Union[int, float], left: typing.Union[int, float], top: typing.Union[int, float], bottom: typing.Union[int, float], complexity: typing.Union[int, float], ratio: typing.Union[int, float], string: bool, basic: list, character: str, data: bool, coloration: Any) -> typing.Union[list, str]
1072
+ │ ├── c_unary(function: Any, projection: str, right: typing.Union[int, float], left: typing.Union[int, float], top: typing.Union[int, float], bottom: typing.Union[int, float], complexity: typing.Union[int, float], ratio: typing.Union[int, float], string: bool, basic: list, character: str, data: bool, coloration: Any) -> typing.Union[list, str]
1119
1073
  │ ├── change(data: typing.Union[list, str]) -> typing.Union[list, str]
1120
1074
  │ ├── color(text: str, rgb: typing.Union[list, tuple]) -> str
1121
1075
  │ └── unary(function: Any, right: typing.Union[int, float], left: typing.Union[int, float], top: typing.Union[int, float], bottom: typing.Union[int, float], complexity: typing.Union[int, float], ratio: typing.Union[int, float], string: bool, basic: list, character: str, data: bool, coloration: Any) -> typing.Union[list, str]
@@ -1180,6 +1134,16 @@ PyPyNum
1180
1134
  ├── types
1181
1135
  │ ├── CLASS
1182
1136
  │ └── FUNCTION
1137
+ ├── ufuncs
1138
+ │ ├── CLASS
1139
+ │ └── FUNCTION
1140
+ │ ├── add(x: Any, y: Any) -> Any
1141
+ │ ├── divide(x: Any, y: Any) -> Any
1142
+ │ ├── floor_divide(x: Any, y: Any) -> Any
1143
+ │ ├── modulo(x: Any, y: Any) -> Any
1144
+ │ ├── multiply(x: Any, y: Any) -> Any
1145
+ │ ├── power(x: Any, y: Any, m: Any) -> Any
1146
+ │ └── subtract(x: Any, y: Any) -> Any
1183
1147
  └── utils
1184
1148
  ├── CLASS
1185
1149
  │ ├── InfIterator(object)/__init__(self: Any, start: typing.Union[int, float, complex], mode: str, common: typing.Union[int, float, complex]) -> Any
@@ -1425,7 +1389,7 @@ print(maths.var([2, 3, 5, 7, 11, 13, 17, 19, 23, 29]))
1425
1389
  plt = plotting.unary(lambda x: x ** 2, top=10, bottom=0, character="+")
1426
1390
  print(plt)
1427
1391
  print(plotting.binary(lambda x, y: x ** 2 + y ** 2 - 10, right=10, left=0, compare="<=", basic=plotting.change(plt)))
1428
- print(plotting.c_unary(lambda x: x ** x, start=-10, end=10, interval=100, right=2, left=-2, top=2, bottom=-2, complexity=20, character="-"))
1392
+ print(plotting.c_unary(lambda x: x ** x, right=2, left=-2, top=2, bottom=-2, complexity=20, character="-"))
1429
1393
 
1430
1394
  """
1431
1395
  1.00e+01| + +
@@ -1466,34 +1430,34 @@ print(plotting.c_unary(lambda x: x ** x, start=-10, end=10, interval=100, right=
1466
1430
  | +++ +++
1467
1431
  0.00e+00|________________________+++________________________
1468
1432
  -5.00e+00 0.00e+00 5.00e+00
1469
- 2.00e+00|
1470
- |
1471
- |
1472
- |
1473
- |
1474
- |
1475
- |
1476
- |
1477
- |
1478
- | -------
1479
- | ------ -----
1480
- | ---- --
1481
- | --- --
1482
- 0.00e+00|_ _ _ _ _ _ _ _ _ _ --_ _ _ _ _ _ _ _ _-- _ _-- _ _ _ ---------------------------
1483
- | -- ------- ---
1484
- | - --
1485
- | - -
1486
- | -- -
1487
- | -- -
1488
- | -- -
1489
- | --- ---
1490
- | ---- ----
1491
- | -------- -------
1492
- | ------------
1493
- |
1494
- |
1495
- |
1496
- -2.00e+00|_________________________________________________________________________________
1433
+ 2.00e+00| - - - - - -
1434
+ | - - - - - - -
1435
+ | - - - - - -
1436
+ |- - - - - - -
1437
+ | - - - - -- - - - -
1438
+ | - - - - - - - - -
1439
+ | - - - - -- - --- -- - -- - - - - -
1440
+ | - - - -- -- - - - -- - - -
1441
+ | - - - - - - - -- - --- --- - - --- -- - -
1442
+ | - - - - - -- ----- -- -- --- -- -- --- -- - -
1443
+ | - - - ------------ ---- - -- -- - --- - - -
1444
+ | - - - - - ----- - -- ----------------------- -- ---- - -- --
1445
+ | - - - - - ---- --------------------------------- - - - - - -
1446
+ 0.00e+00|_ _ _ _ _ _ _ _-_-_-_-_---- ------------------------------------_-- _ _ _ _ _ _ _
1447
+ | - - - - ----------------------------------------- -- - - - -
1448
+ | - -- - - -- - - --------------------------------- - - -
1449
+ | - - ---- - - -- --------------------- ----- ---- - -- -
1450
+ | - - -- --------- -- -- - ----- --- -- - - - -
1451
+ | - - - - - - - ---- --- --- --- -- -- --- - - -
1452
+ | - - - - - -- -- -- - - -- -- --
1453
+ | - - - -- - -- -- - - -- - -
1454
+ | - - - - - - - -- - - -- - -
1455
+ | - - - - -- -- - - - - -
1456
+ | - - - - - - - -
1457
+ |- - - - - - - -
1458
+ | - - - - - -
1459
+ | - - - - -
1460
+ -2.00e+00|___________-_________________-___________-_____________________-____________-____
1497
1461
  -2.00e+00 0.00e+00 2.00e+00
1498
1462
  """
1499
1463
 
@@ -1503,10 +1467,10 @@ print(random.randint(0, 9, [2, 3, 4]))
1503
1467
  print(random.uniform(0, 9, [2, 3, 4]))
1504
1468
 
1505
1469
  """
1506
- [[[1.5224810365398622, -0.3957309179046998, 0.22865800022960608, 0.69458992002954], [1.2796914880445907, -0.9963205507196862, -1.035672172661647, 0.6685698624811087], [0.7966036403993993, 1.4728609716690575, 1.4271945372122727, 1.1346636992788732]], [[-1.5167315121066547, 0.5337355746221562, -0.3856209788535444, 0.9933311189027801], [-0.3000451683620412, 1.985371100287406, 1.0044445415210081, -0.160547602340231], [-1.4024800661532726, -0.2943388293424122, 0.39426575084974064, -0.1788920335787877]]]
1507
- [[[0.5832734051570118, 0.12709072960713108, 0.8460371711928255, 0.7732502834495745], [0.1337174418330055, 0.20214133151753821, 0.11501155244785399, 0.945090241309287], [0.784115524194132, 0.5008953798117651, 0.3514598489060844, 0.2730882163660271]], [[0.8536525608965406, 0.03101021951426164, 0.8904423549934418, 0.30844019778976395], [0.6686071112680847, 0.8622569244011669, 0.5624751157425253, 0.25138337174684133], [0.28360470724085995, 0.31597491199666694, 0.8115190344839784, 0.2685895801115009]]]
1508
- [[[7, 1, 2, 5], [0, 7, 9, 9], [3, 0, 5, 6]], [[2, 2, 4, 3], [9, 7, 2, 0], [2, 5, 6, 6]]]
1509
- [[[3.2674331705558304, 8.794845124593792, 8.48281482952606, 4.071439810303413], [3.525937325174985, 8.353244015747865, 5.167113956700689, 8.200558536323298], [0.5729366698493622, 4.49113422389227, 7.736245315815029, 1.9082811620380302]], [[4.889120931109369, 1.6037956737307013, 7.983047897048623, 1.3817112552960102], [5.866208284533167, 0.5963242816793028, 6.17792540726971, 8.415093555918986], [0.2560629015262261, 1.9094767046602064, 5.647362624435581, 4.042400239970636]]]
1470
+ [[[0.4604088962341266, -1.7729143777833498, -1.027113249139529, -1.367335972424437], [1.5152952392963814, 0.1143532276512219, -2.2478367353916626, 0.770010737736378], [-0.4126751204277065, -2.5483288418244814, -0.8493985529797649, -0.5563319772201964]], [[1.9010219123281087, 0.44289739103266357, -0.7148439667426828, -0.742966218100922], [0.21210379525283574, 1.5466635593995341, -0.4536304781981763, 0.5978046752778463], [-0.802299453332161, -1.0295309618075863, 0.5960990076298143, -0.7956578324150254]]]
1471
+ [[[0.6378288221898551, 0.5667742466043126, 0.4656215108828976, 0.15042085420645113], [0.17290475960349394, 0.7286971110875379, 0.645886619551428, 0.6328537921605502], [0.5626377160935252, 0.41015810474249603, 0.9951566294215863, 0.21679108443018347]], [[0.7747392018966252, 0.5885873225687281, 0.4305122635955937, 0.1102178686782671], [0.6823600514076231, 0.919946966200235, 0.9010988477920265, 0.9324975541841414], [0.026520946245817467, 0.7483826867189314, 0.25799134110551736, 0.7231613737350734]]]
1472
+ [[[5, 5, 4, 2], [2, 0, 9, 6], [9, 2, 0, 0]], [[0, 3, 9, 2], [2, 5, 5, 3], [9, 2, 5, 1]]]
1473
+ [[[4.661185893580614, 6.263504213542613, 1.5982048879385133, 4.592524740685044], [5.915777961319595, 0.7073727896327806, 2.6233256174392263, 4.980453415047565], [2.257336580759053, 8.299789041235444, 5.839322602213961, 3.1890466264933925]], [[8.498155134210208, 4.722625882838601, 4.4036516933236705, 4.313235000904077], [3.7418534910533126, 2.7783464437089305, 8.884554145257127, 3.860087039759355], [4.430653527343895, 0.9625175276439548, 6.813933725727357, 7.910773669181097]]]
1510
1474
  """
1511
1475
 
1512
1476
  print(regression.linear_regression(list(range(5)), [2, 4, 6, 7, 8]))
@@ -1515,7 +1479,7 @@ print(regression.polynomial_regression(list(range(5)), [2, 4, 6, 7, 8], 4))
1515
1479
 
1516
1480
  """
1517
1481
  [1.5, 2.4000000000000004]
1518
- [-0.21428571428571183, 2.3571428571428474, 1.9714285714285764]
1482
+ [-0.21428571428571563, 2.3571428571428625, 1.971428571428569]
1519
1483
  [0.08333333334800574, -0.6666666668092494, 1.4166666678382942, 1.1666666648311956, 2.0000000002900613]
1520
1484
  """
1521
1485
 
@@ -37,4 +37,5 @@ pypynum/test.py
37
37
  pypynum/this.py
38
38
  pypynum/tools.py
39
39
  pypynum/types.py
40
+ pypynum/ufuncs.py
40
41
  pypynum/utils.py
@@ -1,11 +1,13 @@
1
1
  from .errors import ShapeError
2
+ from .ufuncs import *
2
3
 
3
4
  ArrayError = ShapeError("The shape of the array is invalid")
5
+ MatchError = ShapeError("The shapes of the two arrays do not match")
4
6
 
5
7
 
6
8
  class Array:
7
9
  """
8
- It is the base class of vectors, matrices, and tensors,
10
+ It is the base class of vectors, matrices, and Arrays,
9
11
  which does not support operations but has many statistical functions.
10
12
  :param data: An array in the form of a list
11
13
  :param check: Check the rationality of the input array
@@ -51,7 +53,7 @@ class Array:
51
53
  return self.data == other.data
52
54
 
53
55
  def __ne__(self, other):
54
- return not self.data == other.data
56
+ return self.data != other.data
55
57
 
56
58
  def __getitem__(self, item):
57
59
  return self.data[item]
@@ -63,6 +65,42 @@ class Array:
63
65
  def __hash__(self):
64
66
  return hash(repr(self.data))
65
67
 
68
+ def __truediv__(self, other):
69
+ if isinstance(other, Array):
70
+ if self.shape != other.shape:
71
+ raise MatchError
72
+ return Array(fill(self.shape, [t1 / t2 for t1, t2 in zip(self.flatten(), other.flatten())]), False)
73
+ elif isinstance(other, (int, float, complex)):
74
+ return function(self, divide, [other])
75
+ else:
76
+ raise ValueError("Another must be an array or number")
77
+
78
+ def __floordiv__(self, other):
79
+ if isinstance(other, Array):
80
+ if self.shape != other.shape:
81
+ raise MatchError
82
+ return Array(fill(self.shape, [t1 // t2 for t1, t2 in zip(self.flatten(), other.flatten())]), False)
83
+ elif isinstance(other, (int, float, complex)):
84
+ return function(self, floor_divide, [other])
85
+ else:
86
+ raise ValueError("Another must be an array or number")
87
+
88
+ def __mod__(self, other):
89
+ if isinstance(other, Array):
90
+ if self.shape != other.shape:
91
+ raise MatchError
92
+ return Array(fill(self.shape, [t1 % t2 for t1, t2 in zip(self.flatten(), other.flatten())]), False)
93
+ elif isinstance(other, (int, float, complex)):
94
+ return function(self, modulo, [other])
95
+ else:
96
+ raise ValueError("Another must be an array or number")
97
+
98
+ def __pow__(self, _exp, _mod=None):
99
+ if isinstance(_exp, (int, float, complex)) and isinstance(_mod, (int, float, complex, type(None))):
100
+ return function(self, power, [_exp, _mod])
101
+ else:
102
+ raise ValueError()
103
+
66
104
  def flatten(self):
67
105
  data = self.data
68
106
  while isinstance(data[0], list):
@@ -181,7 +219,7 @@ def zeros_like(_nested_list):
181
219
  return 0
182
220
 
183
221
 
184
- def fill(shape, sequence=None, repeat=True):
222
+ def fill(shape, sequence=None, repeat=True, pad=0):
185
223
  pointer = -1
186
224
  length = 1
187
225
  for item in shape:
@@ -189,12 +227,13 @@ def fill(shape, sequence=None, repeat=True):
189
227
  if sequence is None:
190
228
  sequence = list(range(length))
191
229
  total = len(sequence)
230
+ last = total - 1
192
231
 
193
232
  def inner(_shape):
194
233
  nonlocal pointer
195
234
  if len(_shape) == 0:
196
- if pointer == total and not repeat:
197
- return 0
235
+ if pointer == last and not repeat:
236
+ return pad
198
237
  pointer += 1
199
238
  return sequence[pointer % total]
200
239
  else:
@@ -222,4 +261,4 @@ def function(_array, _function, args=None):
222
261
  else:
223
262
  return _function(_array) if args is None else _function(_array, *args)
224
263
 
225
- return type(_array)(inner(data))
264
+ return type(_array)(inner(data), False)