| 1 | initial version |
After defining x = var("x", n=11) the variables are x0, x1, ..., x10.
If you want x_0, x_1, ..., x_10, use
sage: x = var("x_", n=11)
Then to test if a certain condition involves a certain variable, use the has method:
sage: Cond = [x_1 >= 0, x_2 == 0, x_6 <= 0]
sage: c = Cond[0]
sage: c.has(x_1)
True
sage: c.has(x_2)
False
One way to list the variables not used in any of the conditions is therefore:
sage: [xj for xj in x if not any(c.has(xj) for c in Cond)]
[x_0, x_3, x_4, x_5, x_7, x_8, x_9, x_10]
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.