I have a huge output from Resolve
(quantifier elimination) that I must parse to extract the coefficients as numbers. Take for instance something that looks like this:
(c | x | y | z) \[Element] Reals && (c <= 1 &&
c > -1 && -x - y + z == 0 && -2 c + 2 x >= -2)
As you can see, it outputs the basis and domain, followed by the expressions for the region the solution defines. (In this case, for instance, c <= 1
would be what I call an "expression", as well as -x - y + z == 0
.)
I now must extract the coefficients from each expression of this result. A reasonable output for the example above would be to build the list
{{1, 0, 0, 0, "<=", 1}, {1, 0, 0, 0, ">", -1},
{0, -1, -1, 1, "==", 0}, {-2, 2, 0, 0, ">=", -2}}
but anything reasonable (in the sense it'd allow me to get the extract coefficients of each expression as numbers, while also storing the relation type) would do.
The closest hint I found in the documentation was the Coefficient
function, but I couldn't adapt it to work in this case. Is it possible to do so? If not, are there other built-in options?
Also, I've seen a few related questions (such as this) that do something similar using pattern matching, but for a single expression. Would this approach be a extensible to my case? Do you have any hints on how should I proceed to apply it to my situation?
I'm quite new to Wolfram Language so I appreciate any help whatsoever.