PyPyNum 1.0.1__tar.gz → 1.0.2__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.0.1 → PyPyNum-1.0.2}/PKG-INFO +77 -5
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/PyPyNum.egg-info/PKG-INFO +77 -5
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/PyPyNum.egg-info/SOURCES.txt +2 -0
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/pypynum/Matrix.py +5 -0
- PyPyNum-1.0.2/pypynum/Symbolics.py +68 -0
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/pypynum/__init__.py +1 -1
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/pypynum/test.py +16 -2
- PyPyNum-1.0.2/pypynum/this.py +2 -0
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/setup.py +1001 -929
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/PyPyNum.egg-info/dependency_links.txt +0 -0
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/PyPyNum.egg-info/top_level.txt +0 -0
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/pypynum/Geometry.py +0 -0
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/pypynum/Quaternion.py +0 -0
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/pypynum/Tensor.py +0 -0
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/pypynum/constants.py +0 -0
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/pypynum/equations.py +0 -0
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/pypynum/mathematics.py +0 -0
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/pypynum/plotting.py +0 -0
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/pypynum/regression.py +0 -0
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/pypynum/tools.py +0 -0
- {PyPyNum-1.0.1 → PyPyNum-1.0.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyPyNum
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: A Python math package written in pure Python programming language
|
|
5
5
|
Home-page: https://www.gitee.com/PythonSJL/PyPyNum
|
|
6
6
|
Author: Shen Jiayi
|
|
@@ -673,8 +673,9 @@ Description-Content-Type: text/markdown
|
|
|
673
673
|
|
|
674
674
|
# PyPyNum
|
|
675
675
|
|
|
676
|
-
## Version -> 1.0.
|
|
677
|
-
###
|
|
676
|
+
## Version -> 1.0.2
|
|
677
|
+
### PyPI -> https://pypi.org/project/PyPyNum/
|
|
678
|
+
### Gitee -> https://gitee.com/PythonSJL/PyPyNum
|
|
678
679
|
|
|
679
680
|
#### 介绍
|
|
680
681
|
#### Introduction
|
|
@@ -685,6 +686,43 @@ Description-Content-Type: text/markdown
|
|
|
685
686
|
3. 如需联系,QQ 2261748025 (Py𝙿𝚢𝚝𝚑𝚘𝚗-水晶兰)
|
|
686
687
|
3. If you need to contact, QQ 2261748025 (Py𝙿𝚢𝚝𝚑𝚘𝚗-水晶兰)
|
|
687
688
|
|
|
689
|
+
#### PyPyNum的Zen
|
|
690
|
+
#### The Zen of PyPyNum
|
|
691
|
+
```
|
|
692
|
+
The Zen of PyPyNum, by Shen Jiayi
|
|
693
|
+
|
|
694
|
+
This is a math package written purely in Python.
|
|
695
|
+
|
|
696
|
+
...(Do you want to see the entire content?
|
|
697
|
+
Then enter "from pypynum import this" on your
|
|
698
|
+
Python interpreter and run it!)
|
|
699
|
+
|
|
700
|
+
December 27, 2023
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
#### 与上一个版本相比新增功能
|
|
704
|
+
#### New features compared to the previous version
|
|
705
|
+
```
|
|
706
|
+
Symbolics (符号计算)
|
|
707
|
+
FUNCTIONS
|
|
708
|
+
interpreter(expr: str) -> list
|
|
709
|
+
DATA
|
|
710
|
+
basic = '%()*+-./0123456789'
|
|
711
|
+
english = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
|
712
|
+
greek = 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟ∏ΡΣΤΥΦΧΨΩβγδεζηθικλμνξοπρστυφχψω'
|
|
713
|
+
operators = ['**', '*', '//', '/', '%', '+', '-']
|
|
714
|
+
valid = '%()*+-./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcd...yzΑΒΓΔΕΖΗΘ...'
|
|
715
|
+
|
|
716
|
+
(More features need to be added)
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
#### 下一个版本预期新增功能
|
|
720
|
+
#### Expected new features in the next version
|
|
721
|
+
```
|
|
722
|
+
[Vector module]
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
|
|
688
726
|
#### 基本结构
|
|
689
727
|
#### Basic structure
|
|
690
728
|
```
|
|
@@ -723,6 +761,15 @@ PyPyNum
|
|
|
723
761
|
change(data: Euler | Quaternion) -> Quaternion | Euler
|
|
724
762
|
euler(yaw: int | float = 0, pitch: int | float = 0, roll: int | float = 0) -> Euler
|
|
725
763
|
quat(w: int | float = 0, x: int | float = 0, y: int | float = 0, z: int | float = 0) -> Quaternion
|
|
764
|
+
Symbolics
|
|
765
|
+
FUNCTIONS
|
|
766
|
+
interpreter(expr: str) -> list
|
|
767
|
+
DATA
|
|
768
|
+
basic = '%()*+-./0123456789'
|
|
769
|
+
english = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
|
770
|
+
greek = 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟ∏ΡΣΤΥΦΧΨΩβγδεζηθικλμνξοπρστυφχψω'
|
|
771
|
+
operators = ['**', '*', '//', '/', '%', '+', '-']
|
|
772
|
+
valid = '%()*+-./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcd...yzΑΒΓΔΕΖΗΘ...'
|
|
726
773
|
Tensor
|
|
727
774
|
CLASSES
|
|
728
775
|
Tensor
|
|
@@ -857,8 +904,7 @@ PyPyNum
|
|
|
857
904
|
#### 代码测试
|
|
858
905
|
#### Code testing
|
|
859
906
|
```
|
|
860
|
-
|
|
861
|
-
>>> from pypynum import Geometry, Matrix, Quaternion, Tensor, constants, equations, mathematics, regression, plotting, tools
|
|
907
|
+
>>> from pypynum import Geometry, Matrix, Quaternion, Symbolics, Tensor, constants, equations, mathematics, regression, plotting, tools
|
|
862
908
|
|
|
863
909
|
...
|
|
864
910
|
|
|
@@ -908,6 +954,16 @@ PyPyNum
|
|
|
908
954
|
(0.18257418583505536+-0.3651483716701107i+-0.5477225575051661j+-0.7302967433402214k)
|
|
909
955
|
(5+-6i+-7j+-8k)
|
|
910
956
|
|
|
957
|
+
>>> print(Symbolics.basic)
|
|
958
|
+
>>> print(Symbolics.english)
|
|
959
|
+
>>> print(Symbolics.greek)
|
|
960
|
+
>>> print(Symbolics.interpreter("-(10+a-(3.14+b0)*(-5))**(-ζn1-2.718/mΣ99)//9"))
|
|
961
|
+
|
|
962
|
+
%()*+-./0123456789
|
|
963
|
+
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
|
964
|
+
ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟ∏ΡΣΤΥΦΧΨΩβγδεζηθικλμνξοπρστυφχψω
|
|
965
|
+
[['10', '+', 'a', '-', ['3.14', '+', 'b0'], '*', '-5'], '**', ['-ζn1', '-', '2.718', '/', 'mΣ99'], '//', '9']
|
|
966
|
+
|
|
911
967
|
>>> t0 = Tensor.ten([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
|
|
912
968
|
>>> t1 = Tensor.ten([[[9, 10], [11, 12]], [[13, 14], [15, 16]]])
|
|
913
969
|
>>> print(t0)
|
|
@@ -1069,4 +1125,20 @@ f(x) = -0.214285714 * x ** 2 + 2.357142857 * x + 1.971428571
|
|
|
1069
1125
|
['Python', 6, 'NumPy', <class 'int'>, 'PyPyNum', 9, 'pypynum', True]
|
|
1070
1126
|
[0.0, 0.4, 0.8, 1.2000000000000002, 1.6, 2.0, 2.4000000000000004, 2.8000000000000003]
|
|
1071
1127
|
[0.0, 0.39999999999999997, 0.7999999999999999, 1.2, 1.5999999999999999, 1.9999999999999998, 2.4, 2.8]
|
|
1128
|
+
|
|
1129
|
+
提示:
|
|
1130
|
+
|
|
1131
|
+
测试已成功通过并结束。
|
|
1132
|
+
|
|
1133
|
+
这些测试只是这个包功能的一部分。
|
|
1134
|
+
|
|
1135
|
+
更多的功能需要自己探索和尝试!
|
|
1136
|
+
|
|
1137
|
+
Tip:
|
|
1138
|
+
|
|
1139
|
+
The test has been successfully passed and ended.
|
|
1140
|
+
|
|
1141
|
+
These tests are only part of the functionality of this package.
|
|
1142
|
+
|
|
1143
|
+
More features need to be explored and tried by yourself!
|
|
1072
1144
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyPyNum
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: A Python math package written in pure Python programming language
|
|
5
5
|
Home-page: https://www.gitee.com/PythonSJL/PyPyNum
|
|
6
6
|
Author: Shen Jiayi
|
|
@@ -673,8 +673,9 @@ Description-Content-Type: text/markdown
|
|
|
673
673
|
|
|
674
674
|
# PyPyNum
|
|
675
675
|
|
|
676
|
-
## Version -> 1.0.
|
|
677
|
-
###
|
|
676
|
+
## Version -> 1.0.2
|
|
677
|
+
### PyPI -> https://pypi.org/project/PyPyNum/
|
|
678
|
+
### Gitee -> https://gitee.com/PythonSJL/PyPyNum
|
|
678
679
|
|
|
679
680
|
#### 介绍
|
|
680
681
|
#### Introduction
|
|
@@ -685,6 +686,43 @@ Description-Content-Type: text/markdown
|
|
|
685
686
|
3. 如需联系,QQ 2261748025 (Py𝙿𝚢𝚝𝚑𝚘𝚗-水晶兰)
|
|
686
687
|
3. If you need to contact, QQ 2261748025 (Py𝙿𝚢𝚝𝚑𝚘𝚗-水晶兰)
|
|
687
688
|
|
|
689
|
+
#### PyPyNum的Zen
|
|
690
|
+
#### The Zen of PyPyNum
|
|
691
|
+
```
|
|
692
|
+
The Zen of PyPyNum, by Shen Jiayi
|
|
693
|
+
|
|
694
|
+
This is a math package written purely in Python.
|
|
695
|
+
|
|
696
|
+
...(Do you want to see the entire content?
|
|
697
|
+
Then enter "from pypynum import this" on your
|
|
698
|
+
Python interpreter and run it!)
|
|
699
|
+
|
|
700
|
+
December 27, 2023
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
#### 与上一个版本相比新增功能
|
|
704
|
+
#### New features compared to the previous version
|
|
705
|
+
```
|
|
706
|
+
Symbolics (符号计算)
|
|
707
|
+
FUNCTIONS
|
|
708
|
+
interpreter(expr: str) -> list
|
|
709
|
+
DATA
|
|
710
|
+
basic = '%()*+-./0123456789'
|
|
711
|
+
english = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
|
712
|
+
greek = 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟ∏ΡΣΤΥΦΧΨΩβγδεζηθικλμνξοπρστυφχψω'
|
|
713
|
+
operators = ['**', '*', '//', '/', '%', '+', '-']
|
|
714
|
+
valid = '%()*+-./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcd...yzΑΒΓΔΕΖΗΘ...'
|
|
715
|
+
|
|
716
|
+
(More features need to be added)
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
#### 下一个版本预期新增功能
|
|
720
|
+
#### Expected new features in the next version
|
|
721
|
+
```
|
|
722
|
+
[Vector module]
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
|
|
688
726
|
#### 基本结构
|
|
689
727
|
#### Basic structure
|
|
690
728
|
```
|
|
@@ -723,6 +761,15 @@ PyPyNum
|
|
|
723
761
|
change(data: Euler | Quaternion) -> Quaternion | Euler
|
|
724
762
|
euler(yaw: int | float = 0, pitch: int | float = 0, roll: int | float = 0) -> Euler
|
|
725
763
|
quat(w: int | float = 0, x: int | float = 0, y: int | float = 0, z: int | float = 0) -> Quaternion
|
|
764
|
+
Symbolics
|
|
765
|
+
FUNCTIONS
|
|
766
|
+
interpreter(expr: str) -> list
|
|
767
|
+
DATA
|
|
768
|
+
basic = '%()*+-./0123456789'
|
|
769
|
+
english = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
|
770
|
+
greek = 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟ∏ΡΣΤΥΦΧΨΩβγδεζηθικλμνξοπρστυφχψω'
|
|
771
|
+
operators = ['**', '*', '//', '/', '%', '+', '-']
|
|
772
|
+
valid = '%()*+-./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcd...yzΑΒΓΔΕΖΗΘ...'
|
|
726
773
|
Tensor
|
|
727
774
|
CLASSES
|
|
728
775
|
Tensor
|
|
@@ -857,8 +904,7 @@ PyPyNum
|
|
|
857
904
|
#### 代码测试
|
|
858
905
|
#### Code testing
|
|
859
906
|
```
|
|
860
|
-
|
|
861
|
-
>>> from pypynum import Geometry, Matrix, Quaternion, Tensor, constants, equations, mathematics, regression, plotting, tools
|
|
907
|
+
>>> from pypynum import Geometry, Matrix, Quaternion, Symbolics, Tensor, constants, equations, mathematics, regression, plotting, tools
|
|
862
908
|
|
|
863
909
|
...
|
|
864
910
|
|
|
@@ -908,6 +954,16 @@ PyPyNum
|
|
|
908
954
|
(0.18257418583505536+-0.3651483716701107i+-0.5477225575051661j+-0.7302967433402214k)
|
|
909
955
|
(5+-6i+-7j+-8k)
|
|
910
956
|
|
|
957
|
+
>>> print(Symbolics.basic)
|
|
958
|
+
>>> print(Symbolics.english)
|
|
959
|
+
>>> print(Symbolics.greek)
|
|
960
|
+
>>> print(Symbolics.interpreter("-(10+a-(3.14+b0)*(-5))**(-ζn1-2.718/mΣ99)//9"))
|
|
961
|
+
|
|
962
|
+
%()*+-./0123456789
|
|
963
|
+
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
|
964
|
+
ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟ∏ΡΣΤΥΦΧΨΩβγδεζηθικλμνξοπρστυφχψω
|
|
965
|
+
[['10', '+', 'a', '-', ['3.14', '+', 'b0'], '*', '-5'], '**', ['-ζn1', '-', '2.718', '/', 'mΣ99'], '//', '9']
|
|
966
|
+
|
|
911
967
|
>>> t0 = Tensor.ten([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
|
|
912
968
|
>>> t1 = Tensor.ten([[[9, 10], [11, 12]], [[13, 14], [15, 16]]])
|
|
913
969
|
>>> print(t0)
|
|
@@ -1069,4 +1125,20 @@ f(x) = -0.214285714 * x ** 2 + 2.357142857 * x + 1.971428571
|
|
|
1069
1125
|
['Python', 6, 'NumPy', <class 'int'>, 'PyPyNum', 9, 'pypynum', True]
|
|
1070
1126
|
[0.0, 0.4, 0.8, 1.2000000000000002, 1.6, 2.0, 2.4000000000000004, 2.8000000000000003]
|
|
1071
1127
|
[0.0, 0.39999999999999997, 0.7999999999999999, 1.2, 1.5999999999999999, 1.9999999999999998, 2.4, 2.8]
|
|
1128
|
+
|
|
1129
|
+
提示:
|
|
1130
|
+
|
|
1131
|
+
测试已成功通过并结束。
|
|
1132
|
+
|
|
1133
|
+
这些测试只是这个包功能的一部分。
|
|
1134
|
+
|
|
1135
|
+
更多的功能需要自己探索和尝试!
|
|
1136
|
+
|
|
1137
|
+
Tip:
|
|
1138
|
+
|
|
1139
|
+
The test has been successfully passed and ended.
|
|
1140
|
+
|
|
1141
|
+
These tests are only part of the functionality of this package.
|
|
1142
|
+
|
|
1143
|
+
More features need to be explored and tried by yourself!
|
|
1072
1144
|
```
|
|
@@ -6,6 +6,7 @@ PyPyNum.egg-info/top_level.txt
|
|
|
6
6
|
pypynum/Geometry.py
|
|
7
7
|
pypynum/Matrix.py
|
|
8
8
|
pypynum/Quaternion.py
|
|
9
|
+
pypynum/Symbolics.py
|
|
9
10
|
pypynum/Tensor.py
|
|
10
11
|
pypynum/__init__.py
|
|
11
12
|
pypynum/constants.py
|
|
@@ -14,4 +15,5 @@ pypynum/mathematics.py
|
|
|
14
15
|
pypynum/plotting.py
|
|
15
16
|
pypynum/regression.py
|
|
16
17
|
pypynum/test.py
|
|
18
|
+
pypynum/this.py
|
|
17
19
|
pypynum/tools.py
|
|
@@ -285,6 +285,11 @@ def qr(matrix):
|
|
|
285
285
|
|
|
286
286
|
|
|
287
287
|
def eig(matrix):
|
|
288
|
+
print("""\033[91m
|
|
289
|
+
提示:Matrix模块的eig函数与svd函数可能存在计算错误
|
|
290
|
+
|
|
291
|
+
Tip:There may be calculation errors in the eig and svd functions of the Matrix module
|
|
292
|
+
\033[m""")
|
|
288
293
|
_qr = []
|
|
289
294
|
n = matrix.rows
|
|
290
295
|
Q = identity(n)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
operators = ["**", "*", "//", "/", "%", "+", "-"]
|
|
2
|
+
basic = "%()*+-./0123456789"
|
|
3
|
+
english = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
|
4
|
+
greek = "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟ∏ΡΣΤΥΦΧΨΩβγδεζηθικλμνξοπρστυφχψω"
|
|
5
|
+
valid = basic + english + greek
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def interpreter(expr: str) -> list:
|
|
9
|
+
expr = expr.replace(" ", "")
|
|
10
|
+
if any([item not in valid for item in expr]):
|
|
11
|
+
raise ValueError("Characters other than Arabic numerals, English letters, Greek letters, operators, "
|
|
12
|
+
"decimal points, and parentheses cannot appear in expressions")
|
|
13
|
+
if expr[0] not in "0123456789-(" or expr[-1] not in "0123456789)":
|
|
14
|
+
raise ValueError("Syntax error in expression")
|
|
15
|
+
depth = 0
|
|
16
|
+
pointer = 0
|
|
17
|
+
result = []
|
|
18
|
+
for index in range(len(expr)):
|
|
19
|
+
if expr[index] == "(":
|
|
20
|
+
if depth == 0:
|
|
21
|
+
result.append(index)
|
|
22
|
+
depth += 1
|
|
23
|
+
elif expr[index] == ")":
|
|
24
|
+
if depth == 0:
|
|
25
|
+
raise ValueError("The parentheses in the expression are not paired")
|
|
26
|
+
depth -= 1
|
|
27
|
+
if depth == 0:
|
|
28
|
+
sub = interpreter(expr[result[-1] + 1:index])
|
|
29
|
+
if not sub:
|
|
30
|
+
raise ValueError("The inside of the parentheses in an expression cannot be empty")
|
|
31
|
+
result[-1] = sub
|
|
32
|
+
elif depth == 0 and expr[index] in operators:
|
|
33
|
+
number = expr[pointer:index]
|
|
34
|
+
if number and "(" not in number:
|
|
35
|
+
if number.count(".") > 1:
|
|
36
|
+
raise ValueError("Syntax error in expression")
|
|
37
|
+
nan = True
|
|
38
|
+
for item in number:
|
|
39
|
+
if nan and item.isdigit():
|
|
40
|
+
nan = False
|
|
41
|
+
elif not nan and not (item == "." or item.isdigit()):
|
|
42
|
+
raise NameError("The name of the algebra is invalid")
|
|
43
|
+
result.append(number)
|
|
44
|
+
if index != 0:
|
|
45
|
+
pointer = index + 1
|
|
46
|
+
else:
|
|
47
|
+
pointer = index
|
|
48
|
+
if expr[index] in "*/" and expr[index] == expr[index - 1]:
|
|
49
|
+
if result[-1] in operators:
|
|
50
|
+
raise ValueError("Syntax error in expression")
|
|
51
|
+
result.append(expr[index] * 2)
|
|
52
|
+
elif index != 0 and expr[index] != expr[index + 1]:
|
|
53
|
+
if result[-1] in operators:
|
|
54
|
+
raise ValueError("Syntax error in expression")
|
|
55
|
+
result.append(expr[index])
|
|
56
|
+
number = expr[pointer:]
|
|
57
|
+
if number and "(" not in number:
|
|
58
|
+
result.append(number)
|
|
59
|
+
if depth != 0:
|
|
60
|
+
raise ValueError("The parentheses in the expression are not paired")
|
|
61
|
+
return result if len(result) != 1 else result[0]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# TODO 表达式展开
|
|
65
|
+
# TODO 表达式化简
|
|
66
|
+
# TODO 符号微分
|
|
67
|
+
# TODO 符号积分
|
|
68
|
+
...
|
|
@@ -3,11 +3,12 @@ A Code Test File
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
print("""\033[92m
|
|
6
|
-
>>> from pypynum import Geometry, Matrix, Quaternion, Tensor, constants, equations, mathematics, regression, plotting, tools
|
|
6
|
+
>>> from pypynum import Geometry, Matrix, Quaternion, Symbolics, Tensor, constants, equations, mathematics, regression, plotting, tools
|
|
7
7
|
\033[m""")
|
|
8
8
|
print("...")
|
|
9
9
|
|
|
10
|
-
from . import Geometry, Matrix, Quaternion,
|
|
10
|
+
from . import (Geometry, Matrix, Quaternion, Symbolics, Tensor,
|
|
11
|
+
constants, equations, mathematics, regression, plotting, tools)
|
|
11
12
|
|
|
12
13
|
# Geometry
|
|
13
14
|
print("""\033[92m
|
|
@@ -64,6 +65,18 @@ print(q0.inverse())
|
|
|
64
65
|
print(q1.conjugate())
|
|
65
66
|
del q0, q1
|
|
66
67
|
|
|
68
|
+
# Symbolics
|
|
69
|
+
print("""\033[92m
|
|
70
|
+
>>> print(Symbolics.basic)
|
|
71
|
+
>>> print(Symbolics.english)
|
|
72
|
+
>>> print(Symbolics.greek)
|
|
73
|
+
>>> print(Symbolics.interpreter("-(10+a-(3.14+b0)*(-5))**(-ζn1-2.718/mΣ99)//9"))
|
|
74
|
+
\033[m""")
|
|
75
|
+
print(Symbolics.basic)
|
|
76
|
+
print(Symbolics.english)
|
|
77
|
+
print(Symbolics.greek)
|
|
78
|
+
print(Symbolics.interpreter("-(10+a-(3.14+b0)*(-5))**(-ζn1-2.718/mΣ99)//9"))
|
|
79
|
+
|
|
67
80
|
# Tensor
|
|
68
81
|
print("""\033[92m
|
|
69
82
|
>>> t0 = Tensor.ten([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])
|
|
@@ -160,6 +173,7 @@ print(plt)
|
|
|
160
173
|
print(plotting.binary(lambda x, y: x ** 2 + y ** 2 - 10, right=10, left=0, compare="<=", basic=plotting.change(plt)))
|
|
161
174
|
print(plotting.c_unary(lambda x: x ** x, start=-10, end=10, interval=100, right=2, left=-2, top=2, bottom=-2,
|
|
162
175
|
complexity=20, character="-"))
|
|
176
|
+
del plt
|
|
163
177
|
|
|
164
178
|
# tools
|
|
165
179
|
print("""\033[92m
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Zen = 'rKJHJXTOJX\n\x1d\x1a\x15\x1d\x1b\x1d<XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXrrV\n\x19\x1d\x01X\x19X\x16\x11\x10\x0c\x11\x0fX\x14\x19\x17\x1fX\x0b\x11\x10\x0cX\x0b\x0b\x19\x08\n\r\x0bX\x16\x19\x1bX1rT\x10\x1f\r\x17\x16\x1dX\x0c\x0b\x19\x1eX\x0b\x11X\x1c\x1d\x1d\x08\x0bX\x1d\x0c\x19\x1c\x08\rX\x1d\x10\x0cX\x1e1rT\x0c\x1e\x1d\x14X\x0b\n\x19\x1d\x01X\x1e\x14\x19\x10X\x19X\x1c\x16\x19X\x1d\x16\x17X\x14\x14\x11\x0c\x0bX\x0b\x11X\x1d\n\x1d\x10,rrV\x14\x17\x17\x10\x1b\x0bX\x10\x1f\x11\x10X\x15\x17\n\x1eX\x1c\x1d\x0c\x19\r\x1c\x19\n\x1fX\x01\x1c\x19\x1d\n\x14\x19X\x1d\x0e\x19\x10X1X\x0b\x08\x19\x10\n\x1d(rT\x0b\x14\x19\x17\x1fX\x1f\x16\x11\x0e\x1d\x11\x10\x1b\x19X\x16\x1d\x10\x0fXT\x1d\x0b\n\r\x17\x1bX\x1e7rT\x1d\x1c\x17\x1bX\x1e\x17X\x0b\x1d\x16\x11\x14XHHHHIX\x1c\x1d\x1d\x1b\x00\x1dX\x17\x0cX\x0b\x15\x11\x19X\x1d\x1f\x19\x13\x1b\x19\x08X\x10\x0c\x19\x15X\x0b\x11\x10,rrV\x0c\x11X\x1d\x13\x11\x14X\x16\x19\x1bX\x1d\x16\x17\x01\n\x1d\x0e\x1dX\x1d\x08\x17\x10X1rT\x01(\x11\x1b+X\x1c\x16\x19X\x01(\x15\r6X\x0b\x19X\x10\x1b\r\x0bX\x0b\x1d\x1f\x19\x13\x1b\x19\x08r\x14\x19\x1b\x11\x0c\x19\x15\x1d\x10\x0c\x19\x15X\x1e\x17X\x16\x17\x11\x0c\n\x17\x08X\x14\x14\x19\x15\x0bX\x19X\x1d\x1b\x19\x14\x08\x1d\nX\x16\x19\x1bX\x0c1rT\x1d\x1f\x19\r\x1f\x16\x19\x14X;X\x1d\x0c\r\x1b\x1d\x00\x1dX\x0c\x17\x16\x16\x19\x1bX\x0b\n\x1d\x0c\x1d\n\x08\n\x1d\x0c\x16\x11X\x01(\x01(r\x0c\x19\x10\x0cX\x1d\x1f\x19\x0c\x16\x19\x0e\x1c\x19\x0b\x11\x1cX\x1d\x10\x0cX\n\x17\x1eX\x1d\x0c\x19\x0b\x16\x1d\x08\x15\x17\x1bX\x16\x19\x1bX\x0c\x11X\x0c\r:rT\x1d\x1f\x19\r\x1f\x16\x19\x14X;X\x0b\x19X\x0c\x0b\x19\x1eX\x0b\x19X\x0c\x17\x16X\x0b\x11X\x16\x17\x10\x0c\x01(X\x1d\n\r\x08X\x10\x1f\r\x17\x10\x0c\x149rrV\x1d\x16\x17\x14\x19X\x1d\x15X\x01\x1aX\x16\x1d\x0c\x0c\x11\n\x0fX\x1c\x1d\x1d\x1c\x16\x11X\x0b\x19\x0fX\x0c\x11XT\n\x1d\x0e\x1d\x0f\x170rrG\x0c\x16\x1d\x1c\r\x0c\x0br\x14\x17\x17\x10\x1b\x0bX\x10\x1f\x11\x10X\x19X\x01\x1aX\x16\x1d\x0c\x0c\x11\n\x0fX\x0b\x19\x0fX\x0b\x11\x10\x0cX\x1d\x0e\x1d\x11\x14\x1d\x1aX\r\x17\x01X\x17<rrV\x16\x17\x10\x0c\x01(X\x16\x11X\x01\x14\x1d\n\r\x08X\x16\x1d\x0c\x0c\x11\n\x0fX\x1d\x1f\x19\x13\x1b\x19\x08X\x10\x0c\x19\x15X\x19X\x0b\x11X\x0b\x11\x10,rr\x11\x01\x19\x112X\x16\x1d\x10+X\x01\x1aXT\x15\r6\x01(\x01(X\x1e\x17X\x16\x1d"X\x1d\x10,XXXXr'
|
|
2
|
+
print("".join([chr(ord(_) ^ 120) for _ in Zen[::-1]]))
|