Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Substitution of multiple variables, for linearization


we want to substitute multiple variables, for example x1x3 would be z1, x2x4 would be z2 and so on.

We save all combinations of monomials in a dictionary, then we wanted to use subs to replace the variables, but it does not work. How could one implement this?

The purpose is for linearization of a large system of equations. A system like this: x[1] + x[1]x[2]x[3] + x[1]x[4]x[6] + x[1] + x[4] + x[5] + x[7], x[0]x[1]x[4] + x[0]x[1] + x[2]x[4] + x[3]x[5]x[6] + x[3]x[5] + x[7] + 1, x[1]x[2] + x[2]x[3]x[6] + x[2]x[4] + 1, x[0]x[5]x[6]x[7] + x[1]x[7] + x[2] + x[7], x[1]x[3]x[7] + x[4] + x[5]x[6] + x[6], x[1]x[3] + x[2]x[4] + x[3]*x[4]