Given the snippet below:
from sympy import symbols, solve
w, x, y, z = symbols("w x y z")
equations = [
w + x + y - 1,
z - 1,
w/(w+y) - 0.5,
w/(w+y) + y/(w+y) - 1
]
soln = solve(equations, (w, x, y, z), dict=True)[0] # accept first solution
print(soln)
the soln is:
{
w: y,
x: 1.0 - 2.0*y,
z: 1.000
}
Is there a way I can use solve or some other function in SymPy to
change/influence the set of independent variables? In this case, I would
like to prefer x to be independent (used in the expressions of the soln
values) instead of y.
This is a simplified of my actual code. In practice, I don't know which
symbols will can be independent before I call solve, but trivial for me to
order the symbols in order of my preference for them to be independent, if
possible.
Cheers,
Brandon Bocklund
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/01ebfe5e-0a47-496d-b912-42e2bcca4eacn%40googlegroups.com.