Possible bug when a symbolic function is declared twice

asked 2020-06-14 07:14:04 -0600

Florentin Jaffredo gravatar image

updated 2020-06-14 07:16:16 -0600

I don't understand the output of the following code:

sage: f = function('f')
sage: f(x).operator() is f
True
sage: f = function('f')
sage: f(x).operator() is f
False

Is that the intended behavior?

It seems that operator returns the first symbolic function defined with this name, not the actual operator. This is problematic for me because it means there are some cells in my notebook I can only run once, so I have to restart the kernel everytime I want to press "run all".

edit retag flag offensive close merge delete

Comments

1

At the very least, there is some inconsistency between var and function: both of them inject names in the global namespace, but function creates a new object at each call:

sage: var('a') is var('a')
True
sage: function('f') is function('f')
False
eric_g gravatar imageeric_g ( 2020-06-15 05:10:34 -0600 )edit