rgwfuncs 0.0.48__py3-none-any.whl → 0.0.50__py3-none-any.whl
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.
- rgwfuncs/algebra_lib.py +8 -17
- {rgwfuncs-0.0.48.dist-info → rgwfuncs-0.0.50.dist-info}/METADATA +1 -1
- {rgwfuncs-0.0.48.dist-info → rgwfuncs-0.0.50.dist-info}/RECORD +7 -7
- {rgwfuncs-0.0.48.dist-info → rgwfuncs-0.0.50.dist-info}/LICENSE +0 -0
- {rgwfuncs-0.0.48.dist-info → rgwfuncs-0.0.50.dist-info}/WHEEL +0 -0
- {rgwfuncs-0.0.48.dist-info → rgwfuncs-0.0.50.dist-info}/entry_points.txt +0 -0
- {rgwfuncs-0.0.48.dist-info → rgwfuncs-0.0.50.dist-info}/top_level.txt +0 -0
rgwfuncs/algebra_lib.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import re
|
2
2
|
import math
|
3
3
|
import ast
|
4
|
-
# import numpy as np
|
5
4
|
from sympy import symbols, latex, simplify, solve, diff, Expr, factor, cancel, Eq
|
6
5
|
from sympy.core.sympify import SympifyError
|
7
6
|
from sympy.core import S
|
@@ -677,36 +676,28 @@ def solve_homogeneous_polynomial_expression(
|
|
677
676
|
"""
|
678
677
|
|
679
678
|
try:
|
680
|
-
|
681
|
-
print("681", variable)
|
682
|
-
print("682", subs)
|
683
|
-
|
679
|
+
# Handle symbols
|
684
680
|
variable_symbols = set(re.findall(r'\b[a-zA-Z]\w*\b', expression))
|
685
681
|
sym_vars = {var: symbols(var) for var in variable_symbols}
|
686
682
|
|
683
|
+
# Parse the expression
|
687
684
|
expr = parse_expr(expression, local_dict=sym_vars)
|
688
|
-
print("Parsed expression:", expr)
|
689
685
|
|
686
|
+
# Apply substitutions
|
690
687
|
if subs:
|
691
688
|
expr = expr.subs({symbols(k): v for k, v in subs.items()})
|
692
|
-
print("Expression after substitution:", expr)
|
693
689
|
|
690
|
+
# Solve the equation
|
694
691
|
var_symbol = symbols(variable)
|
695
|
-
|
696
692
|
eq = Eq(expr, 0)
|
697
|
-
print("Equation to solve:", eq)
|
698
|
-
|
699
693
|
solutions = solve(eq, var_symbol)
|
700
694
|
|
701
|
-
|
702
|
-
|
703
|
-
result = r"\left[" + ", ".join(latex_solutions) + r"\right]"
|
704
|
-
else:
|
705
|
-
result = r"\left[\right]"
|
695
|
+
# Convert solutions to LaTeX strings with handling for exact representations
|
696
|
+
latex_solutions = [latex(sol) for sol in solutions]
|
706
697
|
|
707
|
-
|
698
|
+
result = r"\left[" + ", ".join(latex_solutions) + r"\right]"
|
699
|
+
print("693", result)
|
708
700
|
return result
|
709
701
|
|
710
702
|
except Exception as e:
|
711
703
|
raise ValueError(f"Error solving the expression: {e}")
|
712
|
-
|
@@ -1,12 +1,12 @@
|
|
1
1
|
rgwfuncs/__init__.py,sha256=vs8xv3IVx7KGpPxEXrIePD3gb_QI1XTXpD_n9817foA,1610
|
2
|
-
rgwfuncs/algebra_lib.py,sha256=
|
2
|
+
rgwfuncs/algebra_lib.py,sha256=_hYqFTiCTNeLsAmLk8hdEUMJK2164NCNeDCPDtiM79w,28212
|
3
3
|
rgwfuncs/df_lib.py,sha256=qqRQdakheLy8wMZRBfHwKyIp8DmdZIWfAiLKWgq03QU,68977
|
4
4
|
rgwfuncs/docs_lib.py,sha256=y3wSAOPO3qsA4HZ7xAtW8HimM8w-c8hjcEzMRLJ96ao,1960
|
5
5
|
rgwfuncs/interactive_shell_lib.py,sha256=A7EWsYxAfDev_N0-2GjRvAtp0bAwBPHIczXb8Gu9fzI,1107
|
6
6
|
rgwfuncs/str_lib.py,sha256=rtAdRlnSJIu3JhI-tA_A0wCiPK2m-zn5RoGpBxv_g-4,2228
|
7
|
-
rgwfuncs-0.0.
|
8
|
-
rgwfuncs-0.0.
|
9
|
-
rgwfuncs-0.0.
|
10
|
-
rgwfuncs-0.0.
|
11
|
-
rgwfuncs-0.0.
|
12
|
-
rgwfuncs-0.0.
|
7
|
+
rgwfuncs-0.0.50.dist-info/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
|
8
|
+
rgwfuncs-0.0.50.dist-info/METADATA,sha256=E7O6Lt05d9SD_y4w-PR-6nZ9tWvOQfGJ1fNjkOf7N-g,55152
|
9
|
+
rgwfuncs-0.0.50.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
10
|
+
rgwfuncs-0.0.50.dist-info/entry_points.txt,sha256=j-c5IOPIQ0252EaOV6j6STio56sbXl2C4ym_fQ0lXx0,43
|
11
|
+
rgwfuncs-0.0.50.dist-info/top_level.txt,sha256=aGuVIzWsKiV1f2gCb6mynx0zx5ma0B1EwPGFKVEMTi4,9
|
12
|
+
rgwfuncs-0.0.50.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|