mingmath 0.2.0__tar.gz → 0.3.0__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.
- {mingmath-0.2.0 → mingmath-0.3.0}/PKG-INFO +44 -49
- mingmath-0.3.0/README.md +104 -0
- {mingmath-0.2.0 → mingmath-0.3.0}/pyproject.toml +72 -48
- mingmath-0.3.0/src/mingmath/__init__.py +107 -0
- mingmath-0.3.0/src/mingmath/file_io.py +30 -0
- mingmath-0.3.0/src/mingmath/gmpy2_functions.py +23 -0
- mingmath-0.3.0/src/mingmath/networkx_functions.py +17 -0
- mingmath-0.3.0/src/mingmath/pari_functions.py +25 -0
- mingmath-0.3.0/src/mingmath/pyvista_functions.py +32 -0
- mingmath-0.3.0/src/mingmath/sage_functions.py +26 -0
- mingmath-0.3.0/src/mingmath/visualization.py +31 -0
- mingmath-0.2.0/README.md +0 -118
- mingmath-0.2.0/src/mingmath/__init__.py +0 -93
- {mingmath-0.2.0 → mingmath-0.3.0}/LICENSE +0 -0
- {mingmath-0.2.0 → mingmath-0.3.0}/src/mingmath/advanced_math.py +0 -0
- {mingmath-0.2.0 → mingmath-0.3.0}/src/mingmath/calculus.py +0 -0
- {mingmath-0.2.0 → mingmath-0.3.0}/src/mingmath/data_structures.py +0 -0
- {mingmath-0.2.0 → mingmath-0.3.0}/src/mingmath/linear.py +0 -0
- {mingmath-0.2.0 → mingmath-0.3.0}/src/mingmath/recursive.py +0 -0
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mingmath
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: A Python package for undergraduate mathematics, including Calculus, Linear Algebra, Data Structures, Recursion, OOP, and
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A Python package for undergraduate mathematics, including Calculus, Linear Algebra, Data Structures, Recursion, OOP, Scientific Computing, File I/O, Data Visualization, Graph Theory, and Advanced Mathematics.
|
|
5
5
|
Author-email: Thayapan <m.thayapan@gmail.com>
|
|
6
6
|
License: MIT
|
|
7
7
|
License-File: LICENSE
|
|
8
|
-
Keywords: calculus,data structures,linear algebra,mathematics,numpy,recursion,scipy,sympy
|
|
8
|
+
Keywords: calculus,data structures,gmpy2,linear algebra,mathematics,matplotlib,networkx,numpy,oop,pari,plotly,pyvista,recursion,sagemath,scipy,seaborn,sympy
|
|
9
9
|
Classifier: Development Status :: 3 - Alpha
|
|
10
10
|
Classifier: Intended Audience :: Education
|
|
11
11
|
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
12
13
|
Classifier: Programming Language :: Python :: 3
|
|
13
14
|
Classifier: Programming Language :: Python :: 3.8
|
|
14
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
15
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Education
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
18
21
|
Requires-Python: >=3.8
|
|
22
|
+
Requires-Dist: cypari2
|
|
23
|
+
Requires-Dist: gmpy2
|
|
19
24
|
Requires-Dist: matplotlib
|
|
25
|
+
Requires-Dist: networkx
|
|
20
26
|
Requires-Dist: numpy
|
|
27
|
+
Requires-Dist: plotly
|
|
28
|
+
Requires-Dist: pyvista
|
|
21
29
|
Requires-Dist: scipy
|
|
30
|
+
Requires-Dist: seaborn
|
|
22
31
|
Requires-Dist: sympy
|
|
23
32
|
Description-Content-Type: text/markdown
|
|
24
33
|
|
|
@@ -27,7 +36,9 @@ Description-Content-Type: text/markdown
|
|
|
27
36
|
MingMath is a Python package for undergraduate mathematics.
|
|
28
37
|
|
|
29
38
|
It provides functions related to Calculus, Linear Algebra,
|
|
30
|
-
Data Structures, Recursion, OOP,
|
|
39
|
+
Data Structures, String Processing, Recursion, OOP,
|
|
40
|
+
Scientific Computing, File I/O, Data Visualization,
|
|
41
|
+
Graph Theory, and Advanced Mathematics.
|
|
31
42
|
|
|
32
43
|
## Features
|
|
33
44
|
|
|
@@ -79,64 +90,48 @@ Data Structures, Recursion, OOP, and Scientific Computing.
|
|
|
79
90
|
- NumPy
|
|
80
91
|
- SciPy
|
|
81
92
|
- SymPy
|
|
82
|
-
- Matplotlib
|
|
83
|
-
|
|
84
|
-
## Installation
|
|
85
93
|
|
|
86
|
-
|
|
87
|
-
pip install mingmath
|
|
88
|
-
```
|
|
94
|
+
### File I/O
|
|
89
95
|
|
|
90
|
-
|
|
96
|
+
- Write text files
|
|
97
|
+
- Read text files
|
|
98
|
+
- Append text to files
|
|
91
99
|
|
|
92
|
-
|
|
93
|
-
import mingmath
|
|
100
|
+
### Data Visualization
|
|
94
101
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
print(mingmath.limit_polynomial([1, 2, 3], 2))
|
|
99
|
-
print(mingmath.maclaurin_exp(1))
|
|
100
|
-
print(mingmath.critical_points_quadratic(1, -4, 3))
|
|
102
|
+
- Matplotlib
|
|
103
|
+
- Seaborn
|
|
104
|
+
- Plotly
|
|
101
105
|
|
|
102
|
-
|
|
103
|
-
A = [[1, 2], [3, 4]]
|
|
104
|
-
B = [[5, 6], [7, 8]]
|
|
106
|
+
### NetworkX
|
|
105
107
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
print(mingmath.transpose(A))
|
|
108
|
+
- Create graphs
|
|
109
|
+
- Calculate node degrees
|
|
110
|
+
- Find shortest paths
|
|
110
111
|
|
|
111
|
-
|
|
112
|
-
print(mingmath.reverse_string("MingMath"))
|
|
113
|
-
print(mingmath.count_vowels("Mathematics"))
|
|
114
|
-
print(mingmath.list_sum([1, 2, 3, 4, 5]))
|
|
112
|
+
### PyVista
|
|
115
113
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
print(mingmath.fibonacci_recursive(10))
|
|
119
|
-
print(mingmath.fibonacci_memo(10))
|
|
114
|
+
- Create 3D mathematical surfaces
|
|
115
|
+
- Display 3D surfaces
|
|
120
116
|
|
|
121
|
-
|
|
122
|
-
print(mingmath.numpy_mean([1, 2, 3, 4, 5]))
|
|
117
|
+
### GMPY2
|
|
123
118
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
119
|
+
- High-precision square root
|
|
120
|
+
- High-precision value of pi
|
|
121
|
+
- High-precision factorial
|
|
127
122
|
|
|
128
|
-
|
|
129
|
-
print(mingmath.scipy_mean([1, 2, 3, 4, 5]))
|
|
123
|
+
### PARI/GP
|
|
130
124
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
```
|
|
125
|
+
- Factorial
|
|
126
|
+
- Integer factorization
|
|
127
|
+
- Greatest common divisor (GCD)
|
|
135
128
|
|
|
136
|
-
|
|
129
|
+
### SageMath
|
|
137
130
|
|
|
138
|
-
|
|
131
|
+
- Check SageMath availability
|
|
132
|
+
- Evaluate mathematical expressions
|
|
139
133
|
|
|
140
|
-
##
|
|
134
|
+
## Installation
|
|
141
135
|
|
|
142
|
-
|
|
136
|
+
```bash
|
|
137
|
+
pip install mingmath
|
mingmath-0.3.0/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# MingMath Package
|
|
2
|
+
|
|
3
|
+
MingMath is a Python package for undergraduate mathematics.
|
|
4
|
+
|
|
5
|
+
It provides functions related to Calculus, Linear Algebra,
|
|
6
|
+
Data Structures, String Processing, Recursion, OOP,
|
|
7
|
+
Scientific Computing, File I/O, Data Visualization,
|
|
8
|
+
Graph Theory, and Advanced Mathematics.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
### Calculus
|
|
13
|
+
|
|
14
|
+
- Power rule derivative
|
|
15
|
+
- Definite integral
|
|
16
|
+
- Polynomial limit
|
|
17
|
+
- Maclaurin series
|
|
18
|
+
- Critical points of quadratic functions
|
|
19
|
+
|
|
20
|
+
### Linear Algebra
|
|
21
|
+
|
|
22
|
+
- Matrix addition
|
|
23
|
+
- Matrix multiplication
|
|
24
|
+
- Determinant of a 2x2 matrix
|
|
25
|
+
- Matrix transpose
|
|
26
|
+
- Dot product
|
|
27
|
+
|
|
28
|
+
### Data Structures and String Processing
|
|
29
|
+
|
|
30
|
+
- String reversal
|
|
31
|
+
- Vowel counting
|
|
32
|
+
- List operations
|
|
33
|
+
- Tuple conversion
|
|
34
|
+
- Dictionary operations
|
|
35
|
+
- Set union
|
|
36
|
+
- Set intersection
|
|
37
|
+
- Exception handling
|
|
38
|
+
|
|
39
|
+
### Recursive Functions
|
|
40
|
+
|
|
41
|
+
- Recursive factorial
|
|
42
|
+
- Recursive Fibonacci
|
|
43
|
+
- Fibonacci with memoization
|
|
44
|
+
|
|
45
|
+
### Object-Oriented Programming
|
|
46
|
+
|
|
47
|
+
- Class and Object
|
|
48
|
+
- Magic methods
|
|
49
|
+
- Single inheritance
|
|
50
|
+
- Multiple inheritance
|
|
51
|
+
- Multilevel inheritance
|
|
52
|
+
- Hierarchical inheritance
|
|
53
|
+
- Hybrid inheritance
|
|
54
|
+
|
|
55
|
+
### Scientific Computing
|
|
56
|
+
|
|
57
|
+
- NumPy
|
|
58
|
+
- SciPy
|
|
59
|
+
- SymPy
|
|
60
|
+
|
|
61
|
+
### File I/O
|
|
62
|
+
|
|
63
|
+
- Write text files
|
|
64
|
+
- Read text files
|
|
65
|
+
- Append text to files
|
|
66
|
+
|
|
67
|
+
### Data Visualization
|
|
68
|
+
|
|
69
|
+
- Matplotlib
|
|
70
|
+
- Seaborn
|
|
71
|
+
- Plotly
|
|
72
|
+
|
|
73
|
+
### NetworkX
|
|
74
|
+
|
|
75
|
+
- Create graphs
|
|
76
|
+
- Calculate node degrees
|
|
77
|
+
- Find shortest paths
|
|
78
|
+
|
|
79
|
+
### PyVista
|
|
80
|
+
|
|
81
|
+
- Create 3D mathematical surfaces
|
|
82
|
+
- Display 3D surfaces
|
|
83
|
+
|
|
84
|
+
### GMPY2
|
|
85
|
+
|
|
86
|
+
- High-precision square root
|
|
87
|
+
- High-precision value of pi
|
|
88
|
+
- High-precision factorial
|
|
89
|
+
|
|
90
|
+
### PARI/GP
|
|
91
|
+
|
|
92
|
+
- Factorial
|
|
93
|
+
- Integer factorization
|
|
94
|
+
- Greatest common divisor (GCD)
|
|
95
|
+
|
|
96
|
+
### SageMath
|
|
97
|
+
|
|
98
|
+
- Check SageMath availability
|
|
99
|
+
- Evaluate mathematical expressions
|
|
100
|
+
|
|
101
|
+
## Installation
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
pip install mingmath
|
|
@@ -1,48 +1,72 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["hatchling"]
|
|
3
|
-
build-backend = "hatchling.build"
|
|
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
|
-
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "mingmath"
|
|
8
|
+
version = "0.3.0"
|
|
9
|
+
|
|
10
|
+
description = "A Python package for undergraduate mathematics, including Calculus, Linear Algebra, Data Structures, Recursion, OOP, Scientific Computing, File I/O, Data Visualization, Graph Theory, and Advanced Mathematics."
|
|
11
|
+
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
|
|
14
|
+
requires-python = ">=3.8"
|
|
15
|
+
|
|
16
|
+
license = { text = "MIT" }
|
|
17
|
+
|
|
18
|
+
authors = [
|
|
19
|
+
{ name = "Thayapan", email = "m.thayapan@gmail.com" }
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
keywords = [
|
|
23
|
+
"mathematics",
|
|
24
|
+
"calculus",
|
|
25
|
+
"linear algebra",
|
|
26
|
+
"data structures",
|
|
27
|
+
"recursion",
|
|
28
|
+
"oop",
|
|
29
|
+
"numpy",
|
|
30
|
+
"scipy",
|
|
31
|
+
"sympy",
|
|
32
|
+
"matplotlib",
|
|
33
|
+
"seaborn",
|
|
34
|
+
"plotly",
|
|
35
|
+
"networkx",
|
|
36
|
+
"pyvista",
|
|
37
|
+
"gmpy2",
|
|
38
|
+
"pari",
|
|
39
|
+
"sagemath"
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
classifiers = [
|
|
43
|
+
"Development Status :: 3 - Alpha",
|
|
44
|
+
"Intended Audience :: Education",
|
|
45
|
+
"License :: OSI Approved :: MIT License",
|
|
46
|
+
"Programming Language :: Python",
|
|
47
|
+
"Programming Language :: Python :: 3",
|
|
48
|
+
"Programming Language :: Python :: 3.8",
|
|
49
|
+
"Programming Language :: Python :: 3.9",
|
|
50
|
+
"Programming Language :: Python :: 3.10",
|
|
51
|
+
"Programming Language :: Python :: 3.11",
|
|
52
|
+
"Programming Language :: Python :: 3.12",
|
|
53
|
+
"Topic :: Education",
|
|
54
|
+
"Topic :: Scientific/Engineering :: Mathematics"
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
dependencies = [
|
|
58
|
+
"numpy",
|
|
59
|
+
"scipy",
|
|
60
|
+
"sympy",
|
|
61
|
+
"matplotlib",
|
|
62
|
+
"seaborn",
|
|
63
|
+
"plotly",
|
|
64
|
+
"networkx",
|
|
65
|
+
"pyvista",
|
|
66
|
+
"gmpy2",
|
|
67
|
+
"cypari2"
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
[tool.hatch.build.targets.wheel]
|
|
72
|
+
packages = ["src/mingmath"]
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MingMath - A mathematics package for undergraduate students.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Calculus
|
|
6
|
+
from .calculus import (
|
|
7
|
+
derivative_power,
|
|
8
|
+
definite_integral_power,
|
|
9
|
+
limit_polynomial,
|
|
10
|
+
maclaurin_exp,
|
|
11
|
+
critical_points_quadratic,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
# Linear Algebra
|
|
15
|
+
from .linear import (
|
|
16
|
+
matrix_add,
|
|
17
|
+
matrix_multiply,
|
|
18
|
+
determinant_2x2,
|
|
19
|
+
transpose,
|
|
20
|
+
dot_product,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# String Processing and Data Structures
|
|
24
|
+
from .data_structures import (
|
|
25
|
+
reverse_string,
|
|
26
|
+
count_vowels,
|
|
27
|
+
list_sum,
|
|
28
|
+
tuple_to_list,
|
|
29
|
+
dictionary_keys,
|
|
30
|
+
set_union,
|
|
31
|
+
set_intersection,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
# Recursion and OOP
|
|
35
|
+
from .recursive import (
|
|
36
|
+
factorial_recursive,
|
|
37
|
+
fibonacci_recursive,
|
|
38
|
+
fibonacci_memo,
|
|
39
|
+
Number,
|
|
40
|
+
PositiveNumber,
|
|
41
|
+
Printable,
|
|
42
|
+
AdvancedNumber,
|
|
43
|
+
ScientificNumber,
|
|
44
|
+
EvenNumber,
|
|
45
|
+
HybridNumber,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
# NumPy, SciPy, SymPy, Matplotlib
|
|
49
|
+
from .advanced_math import (
|
|
50
|
+
numpy_mean,
|
|
51
|
+
numpy_matrix_multiply,
|
|
52
|
+
numpy_matrix_determinant,
|
|
53
|
+
sympy_derivative,
|
|
54
|
+
sympy_integral,
|
|
55
|
+
scipy_mean,
|
|
56
|
+
plot_data,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# File I/O
|
|
60
|
+
from .file_io import (
|
|
61
|
+
write_text_file,
|
|
62
|
+
read_text_file,
|
|
63
|
+
append_text_file,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
# NetworkX
|
|
67
|
+
from .networkx_functions import (
|
|
68
|
+
create_graph,
|
|
69
|
+
graph_degrees,
|
|
70
|
+
shortest_path,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
# Matplotlib, Seaborn, Plotly
|
|
74
|
+
from .visualization import (
|
|
75
|
+
plot_line,
|
|
76
|
+
plot_scatter,
|
|
77
|
+
plot_bar,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# PyVista
|
|
81
|
+
from .pyvista_functions import (
|
|
82
|
+
create_3d_surface,
|
|
83
|
+
show_3d_surface,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# GMPY2
|
|
87
|
+
from .gmpy2_functions import (
|
|
88
|
+
high_precision_sqrt,
|
|
89
|
+
high_precision_pi,
|
|
90
|
+
high_precision_factorial,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
# PARI/GP
|
|
94
|
+
from .pari_functions import (
|
|
95
|
+
pari_factorial,
|
|
96
|
+
pari_factorization,
|
|
97
|
+
pari_gcd,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
# SageMath
|
|
101
|
+
from .sage_functions import (
|
|
102
|
+
sage_available,
|
|
103
|
+
sage_calculate,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
__version__ = "0.3.0"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""
|
|
2
|
+
File I/O functions for reading and writing text files.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def write_text_file(filename, text):
|
|
7
|
+
"""Write text to a file."""
|
|
8
|
+
try:
|
|
9
|
+
with open(filename, "w", encoding="utf-8") as file:
|
|
10
|
+
file.write(text)
|
|
11
|
+
except OSError as e:
|
|
12
|
+
raise OSError(f"Cannot write file: {e}")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def read_text_file(filename):
|
|
16
|
+
"""Read text from a file."""
|
|
17
|
+
try:
|
|
18
|
+
with open(filename, "r", encoding="utf-8") as file:
|
|
19
|
+
return file.read()
|
|
20
|
+
except FileNotFoundError:
|
|
21
|
+
raise FileNotFoundError(f"File not found: {filename}")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def append_text_file(filename, text):
|
|
25
|
+
"""Append text to a file."""
|
|
26
|
+
try:
|
|
27
|
+
with open(filename, "a", encoding="utf-8") as file:
|
|
28
|
+
file.write(text)
|
|
29
|
+
except OSError as e:
|
|
30
|
+
raise OSError(f"Cannot append to file: {e}")
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""
|
|
2
|
+
High-precision mathematics functions using GMPY2.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import gmpy2
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def high_precision_sqrt(number):
|
|
9
|
+
"""Calculate square root with high precision."""
|
|
10
|
+
return gmpy2.sqrt(gmpy2.mpfr(number))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def high_precision_pi():
|
|
14
|
+
"""Return pi with high precision."""
|
|
15
|
+
return gmpy2.const_pi()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def high_precision_factorial(n):
|
|
19
|
+
"""Calculate factorial using GMPY2."""
|
|
20
|
+
if n < 0:
|
|
21
|
+
raise ValueError("n must be non-negative")
|
|
22
|
+
|
|
23
|
+
return gmpy2.fac(n)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import networkx as nx
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def create_graph(edges):
|
|
5
|
+
graph = nx.Graph()
|
|
6
|
+
graph.add_edges_from(edges)
|
|
7
|
+
return graph
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def graph_degrees(edges):
|
|
11
|
+
graph = create_graph(edges)
|
|
12
|
+
return dict(graph.degree())
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def shortest_path(edges, start, end):
|
|
16
|
+
graph = create_graph(edges)
|
|
17
|
+
return nx.shortest_path(graph, start, end)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Number theory functions using PARI/GP through cypari2.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from cypari2 import Pari
|
|
6
|
+
|
|
7
|
+
pari = Pari()
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def pari_factorial(n):
|
|
11
|
+
"""Calculate factorial using PARI/GP."""
|
|
12
|
+
if n < 0:
|
|
13
|
+
raise ValueError("n must be non-negative")
|
|
14
|
+
|
|
15
|
+
return pari(f"factorial({n})")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def pari_factorization(n):
|
|
19
|
+
"""Factorize an integer using PARI/GP."""
|
|
20
|
+
return pari(f"factor({n})")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def pari_gcd(a, b):
|
|
24
|
+
"""Calculate GCD using PARI/GP."""
|
|
25
|
+
return pari(f"gcd({a}, {b})")
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""
|
|
2
|
+
PyVista functions for 3D mathematical visualization.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
import pyvista as pv
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def create_3d_surface(x, y, z):
|
|
10
|
+
"""Create a 3D surface from x, y and z data."""
|
|
11
|
+
x = np.asarray(x)
|
|
12
|
+
y = np.asarray(y)
|
|
13
|
+
z = np.asarray(z)
|
|
14
|
+
|
|
15
|
+
if x.ndim == 1 and y.ndim == 1:
|
|
16
|
+
X, Y = np.meshgrid(x, y)
|
|
17
|
+
else:
|
|
18
|
+
X, Y = x, y
|
|
19
|
+
|
|
20
|
+
if z.shape != X.shape:
|
|
21
|
+
raise ValueError("z must have the same shape as the mesh grid")
|
|
22
|
+
|
|
23
|
+
return pv.StructuredGrid(X, Y, z)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def show_3d_surface(x, y, z):
|
|
27
|
+
"""Display a 3D surface."""
|
|
28
|
+
grid = create_3d_surface(x, y, z)
|
|
29
|
+
|
|
30
|
+
plotter = pv.Plotter()
|
|
31
|
+
plotter.add_mesh(grid)
|
|
32
|
+
plotter.show()
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Mathematical functions using SageMath.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import shutil
|
|
6
|
+
import subprocess
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def sage_available():
|
|
10
|
+
"""Check whether SageMath is installed."""
|
|
11
|
+
return shutil.which("sage") is not None
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def sage_calculate(expression):
|
|
15
|
+
"""Calculate an expression using SageMath."""
|
|
16
|
+
if not sage_available():
|
|
17
|
+
raise RuntimeError("SageMath is not installed or not available in PATH")
|
|
18
|
+
|
|
19
|
+
result = subprocess.run(
|
|
20
|
+
["sage", "-c", f"print({expression})"],
|
|
21
|
+
capture_output=True,
|
|
22
|
+
text=True,
|
|
23
|
+
check=True
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
return result.stdout.strip()
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Data visualization functions using Matplotlib, Seaborn and Plotly.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import matplotlib.pyplot as plt
|
|
6
|
+
import seaborn as sns
|
|
7
|
+
import plotly.express as px
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def plot_line(x, y):
|
|
11
|
+
"""Create a line plot using Matplotlib."""
|
|
12
|
+
plt.plot(x, y)
|
|
13
|
+
plt.xlabel("x")
|
|
14
|
+
plt.ylabel("y")
|
|
15
|
+
plt.title("Line Plot")
|
|
16
|
+
plt.show()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def plot_scatter(x, y):
|
|
20
|
+
"""Create a scatter plot using Seaborn."""
|
|
21
|
+
sns.scatterplot(x=x, y=y)
|
|
22
|
+
plt.xlabel("x")
|
|
23
|
+
plt.ylabel("y")
|
|
24
|
+
plt.title("Scatter Plot")
|
|
25
|
+
plt.show()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def plot_bar(x, y):
|
|
29
|
+
"""Create a bar chart using Plotly."""
|
|
30
|
+
fig = px.bar(x=x, y=y, title="Bar Chart")
|
|
31
|
+
fig.show()
|
mingmath-0.2.0/README.md
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
# MingMath Package
|
|
2
|
-
|
|
3
|
-
MingMath is a Python package for undergraduate mathematics.
|
|
4
|
-
|
|
5
|
-
It provides functions related to Calculus, Linear Algebra,
|
|
6
|
-
Data Structures, Recursion, OOP, and Scientific Computing.
|
|
7
|
-
|
|
8
|
-
## Features
|
|
9
|
-
|
|
10
|
-
### Calculus
|
|
11
|
-
|
|
12
|
-
- Power rule derivative
|
|
13
|
-
- Definite integral
|
|
14
|
-
- Polynomial limit
|
|
15
|
-
- Maclaurin series
|
|
16
|
-
- Critical points of quadratic functions
|
|
17
|
-
|
|
18
|
-
### Linear Algebra
|
|
19
|
-
|
|
20
|
-
- Matrix addition
|
|
21
|
-
- Matrix multiplication
|
|
22
|
-
- Determinant of a 2x2 matrix
|
|
23
|
-
- Matrix transpose
|
|
24
|
-
- Dot product
|
|
25
|
-
|
|
26
|
-
### Data Structures and String Processing
|
|
27
|
-
|
|
28
|
-
- String reversal
|
|
29
|
-
- Vowel counting
|
|
30
|
-
- List operations
|
|
31
|
-
- Tuple conversion
|
|
32
|
-
- Dictionary operations
|
|
33
|
-
- Set union
|
|
34
|
-
- Set intersection
|
|
35
|
-
- Exception handling
|
|
36
|
-
|
|
37
|
-
### Recursive Functions
|
|
38
|
-
|
|
39
|
-
- Recursive factorial
|
|
40
|
-
- Recursive Fibonacci
|
|
41
|
-
- Fibonacci with memoization
|
|
42
|
-
|
|
43
|
-
### Object-Oriented Programming
|
|
44
|
-
|
|
45
|
-
- Class and Object
|
|
46
|
-
- Magic methods
|
|
47
|
-
- Single inheritance
|
|
48
|
-
- Multiple inheritance
|
|
49
|
-
- Multilevel inheritance
|
|
50
|
-
- Hierarchical inheritance
|
|
51
|
-
- Hybrid inheritance
|
|
52
|
-
|
|
53
|
-
### Scientific Computing
|
|
54
|
-
|
|
55
|
-
- NumPy
|
|
56
|
-
- SciPy
|
|
57
|
-
- SymPy
|
|
58
|
-
- Matplotlib
|
|
59
|
-
|
|
60
|
-
## Installation
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
pip install mingmath
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Usage
|
|
67
|
-
|
|
68
|
-
```python
|
|
69
|
-
import mingmath
|
|
70
|
-
|
|
71
|
-
# Calculus
|
|
72
|
-
print(mingmath.derivative_power(3, 2))
|
|
73
|
-
print(mingmath.definite_integral_power(2, 2, 0, 3))
|
|
74
|
-
print(mingmath.limit_polynomial([1, 2, 3], 2))
|
|
75
|
-
print(mingmath.maclaurin_exp(1))
|
|
76
|
-
print(mingmath.critical_points_quadratic(1, -4, 3))
|
|
77
|
-
|
|
78
|
-
# Linear Algebra
|
|
79
|
-
A = [[1, 2], [3, 4]]
|
|
80
|
-
B = [[5, 6], [7, 8]]
|
|
81
|
-
|
|
82
|
-
print(mingmath.matrix_add(A, B))
|
|
83
|
-
print(mingmath.matrix_multiply(A, B))
|
|
84
|
-
print(mingmath.determinant_2x2(A))
|
|
85
|
-
print(mingmath.transpose(A))
|
|
86
|
-
|
|
87
|
-
# Data Structures
|
|
88
|
-
print(mingmath.reverse_string("MingMath"))
|
|
89
|
-
print(mingmath.count_vowels("Mathematics"))
|
|
90
|
-
print(mingmath.list_sum([1, 2, 3, 4, 5]))
|
|
91
|
-
|
|
92
|
-
# Recursive Functions
|
|
93
|
-
print(mingmath.factorial_recursive(5))
|
|
94
|
-
print(mingmath.fibonacci_recursive(10))
|
|
95
|
-
print(mingmath.fibonacci_memo(10))
|
|
96
|
-
|
|
97
|
-
# NumPy
|
|
98
|
-
print(mingmath.numpy_mean([1, 2, 3, 4, 5]))
|
|
99
|
-
|
|
100
|
-
# SymPy
|
|
101
|
-
print(mingmath.sympy_derivative("x**2 + 3*x"))
|
|
102
|
-
print(mingmath.sympy_integral("2*x"))
|
|
103
|
-
|
|
104
|
-
# SciPy
|
|
105
|
-
print(mingmath.scipy_mean([1, 2, 3, 4, 5]))
|
|
106
|
-
|
|
107
|
-
# OOP
|
|
108
|
-
number = mingmath.HybridNumber(3)
|
|
109
|
-
print(number.summary())
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## Version
|
|
113
|
-
|
|
114
|
-
Current version: **0.2.0**
|
|
115
|
-
|
|
116
|
-
## License
|
|
117
|
-
|
|
118
|
-
MIT License
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
MingMath Package
|
|
3
|
-
รวมฟังก์ชันเกี่ยวกับ Calculus, Linear Algebra,
|
|
4
|
-
Data Structures, Recursion, OOP และ Scientific Computing
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from .calculus import (
|
|
8
|
-
derivative_power,
|
|
9
|
-
definite_integral_power,
|
|
10
|
-
limit_polynomial,
|
|
11
|
-
maclaurin_exp,
|
|
12
|
-
critical_points_quadratic
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
from .linear import (
|
|
16
|
-
matrix_add,
|
|
17
|
-
matrix_multiply,
|
|
18
|
-
determinant_2x2,
|
|
19
|
-
transpose,
|
|
20
|
-
dot_product
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
from .data_structures import (
|
|
24
|
-
reverse_string,
|
|
25
|
-
count_vowels,
|
|
26
|
-
list_sum,
|
|
27
|
-
tuple_to_list,
|
|
28
|
-
dictionary_keys,
|
|
29
|
-
set_union,
|
|
30
|
-
set_intersection
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
from .recursive import (
|
|
34
|
-
factorial_recursive,
|
|
35
|
-
fibonacci_recursive,
|
|
36
|
-
fibonacci_memo,
|
|
37
|
-
Number,
|
|
38
|
-
PositiveNumber,
|
|
39
|
-
Printable,
|
|
40
|
-
AdvancedNumber,
|
|
41
|
-
ScientificNumber,
|
|
42
|
-
EvenNumber,
|
|
43
|
-
HybridNumber
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
from .advanced_math import (
|
|
47
|
-
numpy_mean,
|
|
48
|
-
numpy_matrix_multiply,
|
|
49
|
-
numpy_matrix_determinant,
|
|
50
|
-
sympy_derivative,
|
|
51
|
-
sympy_integral,
|
|
52
|
-
scipy_mean,
|
|
53
|
-
plot_data
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
__version__ = "0.2.0"
|
|
57
|
-
|
|
58
|
-
__all__ = [
|
|
59
|
-
"derivative_power",
|
|
60
|
-
"definite_integral_power",
|
|
61
|
-
"limit_polynomial",
|
|
62
|
-
"maclaurin_exp",
|
|
63
|
-
"critical_points_quadratic",
|
|
64
|
-
"matrix_add",
|
|
65
|
-
"matrix_multiply",
|
|
66
|
-
"determinant_2x2",
|
|
67
|
-
"transpose",
|
|
68
|
-
"dot_product",
|
|
69
|
-
"reverse_string",
|
|
70
|
-
"count_vowels",
|
|
71
|
-
"list_sum",
|
|
72
|
-
"tuple_to_list",
|
|
73
|
-
"dictionary_keys",
|
|
74
|
-
"set_union",
|
|
75
|
-
"set_intersection",
|
|
76
|
-
"factorial_recursive",
|
|
77
|
-
"fibonacci_recursive",
|
|
78
|
-
"fibonacci_memo",
|
|
79
|
-
"Number",
|
|
80
|
-
"PositiveNumber",
|
|
81
|
-
"Printable",
|
|
82
|
-
"AdvancedNumber",
|
|
83
|
-
"ScientificNumber",
|
|
84
|
-
"EvenNumber",
|
|
85
|
-
"HybridNumber",
|
|
86
|
-
"numpy_mean",
|
|
87
|
-
"numpy_matrix_multiply",
|
|
88
|
-
"numpy_matrix_determinant",
|
|
89
|
-
"sympy_derivative",
|
|
90
|
-
"sympy_integral",
|
|
91
|
-
"scipy_mean",
|
|
92
|
-
"plot_data"
|
|
93
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|