'Is there an algorithm that can find steps to solve a set of equations
To start, I am not quite sure how to explain the problem and as a result have no clue how to search about it. It is as follows:
I have a large number of equations. The equations can be solved for any given variable, given the other unknowns, or can be solved simultaneously to solve for multiple unknowns. For example, given a and b, equations f(x, y) = a and g(x, y) = b, one can simultaneously solve to get x and y.
I need an algorithm that takes the known values and the equations and return the order in which solving them would result in the desired value.
Example equations:
- f(a, b) = 0
- f(b, c) = 0
Find c given a -> use eq1 to find b given a, then use eq2 to find c given b
Example 2:
- f(x, y, a) = 0
- f(x, y, b) = 0
Find x given a, b -> solve for x and y simultaneously using eq1 and eq2
I have attempted a simpler form of the problem using a graph, where the nodes are variables and edges are equations that connect them. However, this does not account for equations with more than 1 unknown and does not consider simultaneous solving.
Solution 1:[1]
There are a number of steps:
- Match equations and variables as a standard bipartite matching; with edges between equations and variables (and if the maximum matching isn't perfect you have problems) https://cs.stackexchange.com/questions/50410/perfect-matching-in-a-graph-and-complete-matching-in-bipartite-graph
- Find minimal set of equations to solve simultaneously using strongly connected components https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm
- Those sets can then be solved in various ways; tearing is a common technique to reduce the size of the system even further; see e.g., https://people.inf.ethz.ch/~fcellier/Lect/MMPS/Refs/tearing.pdf
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
