Transformations/functions of equalities (and possibly inequalities)

11 views
Skip to first unread message

Emmanuel Charpentier

unread,
Dec 8, 2021, 6:11:23 PM12/8/21
to sage-support

Sage can “distribute” many operations on equalities operands, such as :

sage: var("a, b")
(a, b)
sage: (a==b)+3
a + 3 == b + 3
sage: 3*(a==b)
3*a == 3*b
sage: (a==b)^3
a^3 == b^3

But not common functions :

sage: log(a==b)
log(a == b)
sage: sin(a==b)
sin(a == b)

In both cases above, “distributing” the function would have been either right ((a==b)==> sin(a)==sin(b)) or at least possible (a==b implies that any value log(a) has an equal value of log(b)).

The case of inequalities is more questionable :

sage: 3*(a<b)
3*a < 3*b           # Right
sage: (-3)*(a<b)
-3*a < -3*b        # Wrong, wrong, wrong

What would be expected in the ideal :

sage: log(a==b)
cases([(a>0 and b>0), log(a)==log(b)), (True, log(a==b))])
sage: (-3)*(a<b)
-3*a>-3*b
sage: c*(a<b)
cases([((c>0),a<b),((c<0),a>b)),((c==0), True),(True,c*(a-b))])

etc…

Would work in this direction be useful to Sage ?

Advice ?

Reply all
Reply to author
Forward
0 new messages