I am using sympy to produce symbolic polynomial equations. I have roughly 30 variables and roughly 20 constant variables. The highest power that my equations reach is a squared term.
I need to take 2^13 of these equations and figure out how many of them are unique (i.e., not linear combinations of each other, not degenerate). Otherwise said, I need to find the rank of the matrix produced by the system of equations. Most of these equations are degenerate, they are linear combinations of each other. Ultimately, however, I need to extract the unique equations from the data.
I tried a system as follows:
- Create an empty matrix.
- Iterate over each equation. For each equation, turn it into a row for a matrix, and check the if the rank of the matrix increases by adding the new row.
- If the rank increases, append the row to the empty matrix
- Print the resulting matrix.
If done correctly, this should give all of the unique equations. However, numpy.linalg.matrix_rank() does not work on sympy symbols. Unfortunately, I have roughly 20 constants that are represented by sympy symbols.
How do I find my unique equations? Any of these will solve my problem:
- An explicit solution to get non-degenerate equations
- A method for evaluating the rank of a matrix that has sympy symbols in it.
- Or, does sympy have built-in functionality for determining if a sympy equation is a linear combination of other sympy equations?