1 | initial version |
Sagemath will reduce an equation to True
if the canonical form of its arguments (the "sides" of the equation) are the same.
sage: 1+1==2
True
This prints True
because the canonoical form of 1+1
is 2
, identical to the canonical form of the other argument, and this of these forms are "simple enough" (not formally defined). Counter-example :
sage: var("a, b")
(a, b)
sage: sin(a+b)==sin(a+b)
sin(a + b) == sin(a + b)
In less obvious cases, the canonical forms of the (mathematically equal) arguments are different :
sage: sin(x)^2+cos(x)^2==1
cos(x)^2 + sin(x)^2 == 1
The bool
function actively tries to find a common form of its arguments :
sage: bool(sin(x)^2+cos(x)^2==1)
True
sage: sin(a+b)==sin(a+b).trig_expand()
sin(a + b) == cos(b)*sin(a) + cos(a)*sin(b)
sage: bool(sin(a+b)==sin(a+b).trig_expand())
True
HTH,
2 | No.2 Revision |
EDIT : This answer is at least partially false ; as far a s I can tell, tmonteil
below is right...
Sagemath will reduce an equation to True
if the canonical form of its arguments (the "sides" of the equation) are the same.
sage: 1+1==2
True
This prints True
because the canonoical form of 1+1
is 2
, identical to the canonical form of the other argument, and this of these forms are "simple enough" (not formally defined). Counter-example :
sage: var("a, b")
(a, b)
sage: sin(a+b)==sin(a+b)
sin(a + b) == sin(a + b)
In less obvious cases, the canonical forms of the (mathematically equal) arguments are different :
sage: sin(x)^2+cos(x)^2==1
cos(x)^2 + sin(x)^2 == 1
The bool
function actively tries to find a common form of its arguments :
sage: bool(sin(x)^2+cos(x)^2==1)
True
sage: sin(a+b)==sin(a+b).trig_expand()
sin(a + b) == cos(b)*sin(a) + cos(a)*sin(b)
sage: bool(sin(a+b)==sin(a+b).trig_expand())
True
HTH,
3 | No.3 Revision |
EDIT : This answer is at least partially false ; as far a s as I can tell, tmonteil
below is right...
Kept for the edification of future users...
Sagemath will reduce an equation to True
if the canonical form of its arguments (the "sides" of the equation) are the same.
sage: 1+1==2
True
This prints True
because the canonoical form of 1+1
is 2
, identical to the canonical form of the other argument, and this of these forms are "simple enough" (not formally defined). Counter-example :
sage: var("a, b")
(a, b)
sage: sin(a+b)==sin(a+b)
sin(a + b) == sin(a + b)
In less obvious cases, the canonical forms of the (mathematically equal) arguments are different :
sage: sin(x)^2+cos(x)^2==1
cos(x)^2 + sin(x)^2 == 1
The bool
function actively tries to find a common form of its arguments :
sage: bool(sin(x)^2+cos(x)^2==1)
True
sage: sin(a+b)==sin(a+b).trig_expand()
sin(a + b) == cos(b)*sin(a) + cos(a)*sin(b)
sage: bool(sin(a+b)==sin(a+b).trig_expand())
True
HTH,