Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

It's a peculiarity of sage that object "(print)names" have significance. For instance, QQ['x'] and QQ['t'] are both rings of univariate polynomials over QQ. They are of course isomorphic but in the eyes of sage not canonically so (there are many relations possible between x and t that could establish an isomorphism), and hence sage declines to choose any by default. The same here:

sage: parent(f)
Callable function ring with arguments (x,)
sage: parent(h)
Callable function ring with arguments (t,)

Going from one to the other can be done:

sage: Ct = parent(h)
sage: ft = Ct(f(t))
sage: ft
t |--> t^2
sage: parent(ft)
Callable function ring with arguments (t,)
sage: ft+h
t |--> 2*t^2
sage: parent(ft+h)
Callable function ring with arguments (t,)

Doing it like this might give you a bit of a glimpse "under the hood" into why it works this way.