How to assume the sum of some variables is equal to a constant?
Suppose I have this expression:
$$\frac{a {\left(t_{1} + t_{2} + t_{3} - 1\right)}}{b} $$
This can be simplified to 0 if we assume $t_1 + t_2 + t_3 = 1$.
How can I accomplish this in Sage? I've tried:
var('t1', 't2', 't3', 'a', 'b')
expr1 = ((t1 + t2 + t3 - 1)*a)/b
expr1.full_simplify()
assume(t1 + t2 + t3 == 1)
expr1.full_simplify()
I expected the second call tofull_simplify()
to return 0 but it returned the same result as the first call, which is $$\frac{a t_{1} + a t_{2} + a t_{3} - a}{b}$$
Note that you can work ( in the sense of algebraic geometry) as follows:
Working in the quotient ring modulo the "assumed relations" will always give the reduced expressions without contorsions.
Thanks for the suggestion. Do you have any idea why
assume()
didn't work?Asking for
?assume
we see for instance inthat the command is not designed to work with simplifications hand in hand, but rather with special, unstructured conditions that make an integral, a square root, etc. be defined, or to have evaluations of special functions like
sin
andcos
. To give an unrelated example where we would also "expect more", let us consider...We have to insist to get the whole information.
In your case just insist to get the information:
bool( expr1 == 0 )
.