Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions odetoolbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from sympy.core.expr import Expr as SympyExpr

from .config import Config
from .sympy_helpers import _check_numerical_issue, _check_forbidden_name, _find_in_matrix, _is_zero, _is_sympy_type, SympyPrinter, _sympy_parse_real
from .sympy_helpers import _check_numerical_issue, _check_forbidden_name, _is_zero, _is_sympy_type, SympyPrinter, _sympy_parse_real
from .system_of_shapes import SystemOfShapes
from .shapes import MalformedInputException, Shape

Expand Down Expand Up @@ -79,11 +79,6 @@ def _find_analytically_solvable_equations(shape_sys, shapes, parameters=None):
if not _is_zero(shape_sys.b_[i]) and shape_sys.shape_order_from_system_matrix(i) > 1 and shape_sys.x_[i] in shape_sys.get_connected_symbols(i):
node_is_analytically_solvable[shape_sys.x_[i]] = False

for j in range(len(shape_sys.x_)):
if not i == j and not _is_zero(shape_sys.A_[i, j]) and not _is_zero(shape_sys.b_[_find_in_matrix(shape_sys.x_, shape_sys.x_[j])]):
# this shape depends on another ODE that is inhomogeneous -- can't be solved analytically by this version of ODE-toolbox
node_is_analytically_solvable[shape_sys.x_[i]] = False

node_is_analytically_solvable = shape_sys.propagate_lin_cc_judgements(node_is_analytically_solvable, dependency_edges)
if PLOT_DEPENDENCY_GRAPH:
DependencyGraphPlotter.plot_graph(shapes, dependency_edges, node_is_analytically_solvable, fn="/tmp/ode_dependency_graph_analytically_solvable.dot")
Expand Down
13 changes: 0 additions & 13 deletions odetoolbox/sympy_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,6 @@ def _custom_simplify_expr(expr: Union[str, sympy.matrices.MatrixBase]):
sys.exit(1)


def _find_in_matrix(A, el):
num_rows = A.rows
num_cols = A.cols

# Iterate over the elements of the matrix
for i in range(num_rows):
for j in range(num_cols):
if A[i, j] == el:
return (i, j)

return None


def symbol_in_expression(list_of_symbols, expr) -> bool:
for symbol in list_of_symbols:
if symbol in sympy.preorder_traversal(expr):
Expand Down
4 changes: 0 additions & 4 deletions odetoolbox/system_of_shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,6 @@ def generate_solver_dict_based_on_propagator_matrix_(self, P: sympy.Matrix):
if not _is_zero(P[row, col]):
sym_str = Config().propagators_prefix + "__{}__{}".format(str(self.x_[row]), str(self.x_[col]))
P_expr[sym_str] = P[row, col]
if row != col and not _is_zero(self.b_[col]):
# the ODE for x_[row] depends on the inhomogeneous ODE of x_[col]. We can't solve this analytically in the general case (even though some specific cases might admit a solution)
raise PropagatorGenerationException("the ODE for " + str(self.x_[row]) + " depends on the inhomogeneous ODE of " + str(self.x_[col]) + ". We can't solve this analytically in the general case (even though some specific cases might admit a solution)")

update_expr_terms.append(sym_str + " * " + str(self.x_[col]))

if not _is_zero(self.b_[row]):
Expand Down
Loading