1 | initial version |
This is because of the way the Sage type system works. When you ask Sage to simplify an equation, it tries to do just that: it tries to find a simpler expression. It doesn't change an equation into a boolean truth value. In this case, the fact you're using the symbol "h" for both an expression and a relation is confusing things a bit, I think.
You have the variable a, which is an Expression:
sage: a = var("a")
sage: type(a)
<type 'sage.symbolic.expression.Expression'>
h, which is also an Expression:
sage: h = 2^(a - 2) * 3^(a + 3) / 6^a
sage: type(h)
<type 'sage.symbolic.expression.Expression'>
but isn't an equation or inequality:
sage: h.is_relational()
False
and which simplifies as you note.
sage: h.simplify_full()
27/4
Now we write the equation:
sage: eq = h == 27/4
sage: type(eq)
<type 'sage.symbolic.expression.Expression'>
This is also an Expression, but now it's a little different:
sage: eq.is_relational()
True
If you want to find out if the equation is true, you convert the equation to a boolean value:
sage: bool(eq)
True
In this case you don't even need to simplify it. Does that make sense? Expressions can get simplified, but in general they don't simplify to truth values. You have to ask for that explicitly if that's what you want.
Warning: bool(eq) doesn't mean what you think it might!
Sage inherits the convention that while bool(eq)==True means that the expression is true (subject to whatever assumptions are in effect), bool(eq) == False doesn't mean the expression is false! It only means it couldn't figure out how to prove it.
2 | No.2 Revision |
This is because of the way the Sage type system works. When you ask Sage to simplify an equation, it tries to do just that: it tries to find a simpler expression. It doesn't change an equation into a boolean truth value. In this case, the fact you're using the symbol "h" for both an a (non-relational) expression and a relation is confusing things a bit, I think.
You have the variable a, which is an Expression:
sage: a = var("a")
sage: type(a)
<type 'sage.symbolic.expression.Expression'>
h, which is also an Expression:
sage: h = 2^(a - 2) * 3^(a + 3) / 6^a
sage: type(h)
<type 'sage.symbolic.expression.Expression'>
but isn't an equation or inequality:
sage: h.is_relational()
False
and which simplifies as you note.
sage: h.simplify_full()
27/4
Now we write the equation:
sage: eq = h == 27/4
sage: type(eq)
<type 'sage.symbolic.expression.Expression'>
This is also an Expression, but now it's a little different:
sage: eq.is_relational()
True
If you want to find out if the equation is true, you convert the equation to a boolean value:
sage: bool(eq)
True
In this case you don't even need to simplify it. Does that make sense? Expressions can get simplified, but in general they don't simplify to truth values. You have to ask for that explicitly if that's what you want.
Warning: bool(eq) doesn't mean what you think it might!
Sage inherits the convention that while bool(eq)==True means that the expression is true (subject to whatever assumptions are in effect), bool(eq) == False doesn't mean the expression is false! It only means it couldn't figure out how to prove it.
3 | No.3 Revision |
This is because of the way the Sage type system works. When you ask Sage to simplify an equation, it tries to do just that: it tries to find a simpler expression. It doesn't change an equation into a boolean truth value. In this case, the fact you're using the symbol "h" for both a (non-relational) expression and a relation is confusing things a bit, I think.
You have the variable a, which is an Expression:
sage: a = var("a")
sage: type(a)
<type 'sage.symbolic.expression.Expression'>
h, which is also an Expression:
sage: h = 2^(a - 2) * 3^(a + 3) / 6^a
sage: type(h)
<type 'sage.symbolic.expression.Expression'>
but isn't an equation or inequality:
sage: h.is_relational()
False
and which simplifies as you note.
sage: h.simplify_full()
27/4
Now we write the equation:
sage: eq = h == 27/4
sage: type(eq)
<type 'sage.symbolic.expression.Expression'>
This is also an Expression, but now it's a little different:
sage: eq.is_relational()
True
If you want to find out if the equation is true, you convert the equation to a boolean value:
sage: bool(eq)
True
In this case you don't even need to simplify it. Does that make sense? Expressions can get simplified, but in general they don't simplify to truth values. You have to ask for that explicitly if that's what you want.
Warning: bool(eq) doesn't mean what you think it might!
Sage inherits the convention that while bool(eq)==True means that the expression is true (subject to whatever assumptions are in effect), bool(eq) == False doesn't mean the expression is (necessarily) false! It only means it couldn't figure out how to prove it.