Ask Your Question

Revision history [back]

As a general rule, i would recommend not to use the same term for symbols and polynomial indeterminates.

Regarding your question, the meaning of

sage: foo == t
True

is the following: to decide equality between mathematical elements, Sage uses the coercion model : it constructs a common parent P for foo and t, converts both foo and t in P and test the equality between both P(foo) and P(t).

To find the common parent, you can do :

sage: coercion_model.common_parent(t.parent(), foo.parent())
Multivariate Polynomial Ring in s, t, u over Algebraic Field

As a general rule, i would recommend not to use the same term for symbols and polynomial indeterminates.

Regarding your question, the meaning of

sage: foo == t
True

is the following: to decide equality between mathematical elements, Sage uses the coercion model : it constructs a common parent P for foo and t, converts both foo and t in P and test the equality between both P(foo) and P(t).

To find the common parent, you can do :

sage: coercion_model.common_parent(t.parent(), foo.parent())
Multivariate Polynomial Ring in s, t, u over Algebraic Field

See :

  • https://doc.sagemath.org/html/en/tutorial/tour_coercion.html
  • https://doc.sagemath.org/html/en/reference/coercion/sage/structure/coerce.html
  • https://doc.sagemath.org/html/en/reference/coercion/index.html