rgwfuncs 0.0.45__tar.gz → 0.0.47__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.
- {rgwfuncs-0.0.45/src/rgwfuncs.egg-info → rgwfuncs-0.0.47}/PKG-INFO +1 -1
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/pyproject.toml +1 -1
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/setup.cfg +1 -1
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/src/rgwfuncs/algebra_lib.py +18 -11
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47/src/rgwfuncs.egg-info}/PKG-INFO +1 -1
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/LICENSE +0 -0
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/README.md +0 -0
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/src/rgwfuncs/__init__.py +0 -0
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/src/rgwfuncs/df_lib.py +0 -0
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/src/rgwfuncs/docs_lib.py +0 -0
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/src/rgwfuncs/interactive_shell_lib.py +0 -0
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/src/rgwfuncs/str_lib.py +0 -0
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/src/rgwfuncs.egg-info/SOURCES.txt +0 -0
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/src/rgwfuncs.egg-info/dependency_links.txt +0 -0
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/src/rgwfuncs.egg-info/entry_points.txt +0 -0
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/src/rgwfuncs.egg-info/requires.txt +0 -0
- {rgwfuncs-0.0.45 → rgwfuncs-0.0.47}/src/rgwfuncs.egg-info/top_level.txt +0 -0
@@ -2,7 +2,7 @@ import re
|
|
2
2
|
import math
|
3
3
|
import ast
|
4
4
|
# import numpy as np
|
5
|
-
from sympy import symbols, latex, simplify, solve, diff, Expr, factor, cancel
|
5
|
+
from sympy import symbols, latex, simplify, solve, diff, Expr, factor, cancel, Eq
|
6
6
|
from sympy.core.sympify import SympifyError
|
7
7
|
from sympy.core import S
|
8
8
|
from sympy.parsing.sympy_parser import parse_expr
|
@@ -676,28 +676,35 @@ def solve_homogeneous_polynomial_expression(
|
|
676
676
|
ValueError: If the equation cannot be solved due to errors in expression or parameters.
|
677
677
|
"""
|
678
678
|
|
679
|
+
print("679", expression)
|
680
|
+
print("681", variable)
|
681
|
+
print("682", subs)
|
679
682
|
try:
|
680
683
|
# Create symbols for the variables in the expression
|
681
684
|
variable_symbols = set(re.findall(r'\b[a-zA-Z]\w*\b', expression))
|
682
685
|
sym_vars = {var: symbols(var) for var in variable_symbols}
|
683
686
|
|
684
|
-
# Parse the expression
|
687
|
+
# Parse the expression
|
685
688
|
expr = parse_expr(expression, local_dict=sym_vars)
|
686
|
-
var_symbol = symbols(variable)
|
687
|
-
solutions = solve(expr, var_symbol)
|
688
689
|
|
689
|
-
#
|
690
|
+
# If substitutions are provided, apply them
|
690
691
|
if subs:
|
691
|
-
|
692
|
-
|
692
|
+
expr = expr.subs({symbols(k): v for k, v in subs.items()})
|
693
|
+
|
694
|
+
# Ensure the variable is treated as a symbol for solving
|
695
|
+
var_symbol = symbols(variable)
|
696
|
+
|
697
|
+
# Solve for the variable
|
698
|
+
eq = Eq(expr, 0)
|
699
|
+
solutions = solve(eq, var_symbol)
|
693
700
|
|
694
701
|
# Convert solutions to LaTeX strings if possible
|
695
|
-
latex_solutions = [
|
696
|
-
latex(
|
697
|
-
simplify(sol)) if sol.free_symbols else str(sol) for sol in solutions]
|
702
|
+
latex_solutions = [latex(simplify(sol)) for sol in solutions]
|
698
703
|
result = r"\left[" + ", ".join(latex_solutions) + r"\right]"
|
699
|
-
|
704
|
+
|
705
|
+
print("704", result)
|
700
706
|
return result
|
701
707
|
|
702
708
|
except Exception as e:
|
703
709
|
raise ValueError(f"Error solving the expression: {e}")
|
710
|
+
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|