MingMath
MingMath is a Python package for undergraduate mathematics and mathematical computing.
Installation
pip install mingmath
import mingmath
1. String Processing
print(mingmath.reverse_string("MingMath"))
print(mingmath.count_vowels("MingMath"))
Output:
htaMgniM
2
2. List
numbers = [1, 2, 3, 4, 5]
print(mingmath.list_sum(numbers))
Output:
15
3. Tuple
data = (1, 2, 3)
print(mingmath.tuple_to_list(data))
Output:
[1, 2, 3]
4. Dictionary
student = {"name": "Ming", "year": 2}
print(mingmath.dictionary_keys(student))
Output:
['name', 'year']
5. Set
a = {1, 2, 3}
b = {3, 4, 5}
print(mingmath.set_union(a, b))
print(mingmath.set_intersection(a, b))
Output:
{1, 2, 3, 4, 5}
{3}
6. Positional Arguments
print(mingmath.positional_arguments(10, 20))
Output:
30
7. Keyword Arguments
print(mingmath.keyword_arguments(name="Ming", age=20))
Output:
Ming is 20 years old.
8. Default Arguments
print(mingmath.default_arguments(5))
print(mingmath.default_arguments(5, 3))
Output:
25
125
9. Variable-length Arguments
print(mingmath.variable_length_args(1, 2, 3, 4, 5))
Output:
15
10. Recursive Function
print(mingmath.factorial_recursive(5))
print(mingmath.fibonacci_recursive(6))
Output:
120
8
11. Memoization
print(mingmath.fibonacci_memo(10))
Output:
55
12. Algorithm Comparison
edges = [
("A", "B"),
("B", "C"),
("A", "C")
]
print(mingmath.shortest_path_bfs(edges, "A", "C"))
weighted_edges = [
("A", "B", 4),
("B", "C", 2),
("A", "C", 10)
]
print(mingmath.shortest_path_dijkstra(
weighted_edges, "A", "C"
))
BFS is used for unweighted graphs, while Dijkstra considers edge weights.
13. Class
number = mingmath.Number(10)
print(number.value)
print(number)
Output:
10
Number(10)
14. Magic Methods
a = mingmath.Number(10)
b = mingmath.Number(5)
print(a + b)
Output:
Number(15)
15. Inheritance
number = mingmath.PositiveNumber(10)
print(number.value)
print(number.is_positive())
Output:
10
True
MingMath also demonstrates multiple, multilevel, hierarchical, and hybrid inheritance.
16. File I/O
mingmath.write_text_file(
"example.txt",
"Hello MingMath!"
)
print(mingmath.read_text_file("example.txt"))
Output:
Hello MingMath!
17. Exception Handling
try:
mingmath.factorial_recursive(-1)
except ValueError as error:
print(error)
Output:
n must be non-negative
18. NumPy
numbers = [1, 2, 3, 4, 5]
print(mingmath.numpy_mean(numbers))
Output:
3.0
19. Pandas
data = {
"score": [80, 90, 70],
"age": [19, 20, 19]
}
df = mingmath.create_dataframe(data)
print(df)
Output:
score age
0 80 19
1 90 20
2 70 19
20. SciPy
print(mingmath.scipy_mean([1, 2, 3, 4, 5]))
Output:
3.0
21. SymPy
print(mingmath.sympy_derivative("x**3 + 2*x"))
Output:
3*x**2 + 2
22. SageMath
print(mingmath.sage_available())
Output:
True
SageMath must be installed separately.
23. PARI/GP
print(mingmath.pari_factorial(5))
print(mingmath.pari_gcd(24, 18))
Output:
120
6
24. GMPY2
print(mingmath.high_precision_factorial(10))
Output:
3628800
25. Matplotlib
x = [1, 2, 3, 4]
y = [1, 4, 9, 16]
mingmath.plot_line(x, y)
Creates a line graph.
26. Seaborn
x = [1, 2, 3, 4]
y = [2, 4, 3, 5]
mingmath.plot_scatter(x, y)
Creates a scatter plot.
27. Plotly
x = ["A", "B", "C"]
y = [10, 20, 15]
mingmath.plot_bar(x, y)
Creates an interactive bar chart.
28. NetworkX
edges = [
("A", "B"),
("B", "C")
]
graph = mingmath.create_graph(edges)
print(mingmath.graph_degrees(edges))
Output:
{'A': 1, 'B': 2, 'C': 1}
29. PyVista
import numpy as np
x = np.linspace(-2, 2, 10)
y = np.linspace(-2, 2, 10)
X, Y = np.meshgrid(x, y)
Z = X**2 + Y**2
mingmath.show_3d_surface(X, Y, Z)
Creates a 3D mathematical surface.
Version
0.4.0
License
MIT License
Metadata
Release files for mingmath 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mingmath-0.4.0.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mingmath-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.4 kB
Release files / mingmath-0.4.0.tar.gz
| Download URL | mingmath-0.4.0.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9df45ec615a4ef224a287926872dd2fa1acbe810c63eafeba30f0cffce2d6bc
|
|
BLAKE2b-256 checksum How to use checksums |
661933b1ab83ca8653cfd1a8979e191214f844ccd4c9333f0c6e8cc695b1fb4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / mingmath-0.4.0-py3-none-any.whl
| Download URL | mingmath-0.4.0-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa7d95336b7cec236cd8587284782cbcf77f2c73159f72ba2de1e1c331b5173d
|
|
BLAKE2b-256 checksum How to use checksums |
7a648be63e6526c9c72b3559f276f36fc952be324fb371503f64241b441a685b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|