Hi,

Consider the following code with Sage 9.0.beta7:

sage: x, y = var('x y', domain='real')
sage: phi = function('phi', latex_name=r'\varphi')
sage: s = phi(x, y).simplify()
sage: s
phi(x, y)

It looks good, but it is not:

sage: s.subs({phi(x, y): 1})
phi(x, y)

The failure of the substitution is due to the fact that the phi that 
appears in s is different from the original phi:

sage: s.operator()
phi
sage: s.operator() == phi
False

A LaTeX printiing would have revealed the difference:

sage: latex(s)
\phi\left(x, y\right)
sage: latex(phi(x,y))
\varphi\left(x, y\right)

What is weird is that if one permutes the first two lines of the above 
code, i.e. if one starts with

sage: phi = function('phi', latex_name=r'\varphi')
sage: x, y = var('x y', domain='real')

Then everything is fine:

sage: s = phi(x, y).simplify()
sage: s
phi(x, y)
sage: s.subs({phi(x, y): 1})
1
sage: s.operator()
phi
sage: s.operator() == phi
True
sage: latex(s)
\varphi\left(x, y\right)

Other data points: 
- if one omits domain='real' for x,y, then everything is fine
- if one uses a single variable for phi, I.e. phi(x), then everything is 
fine
- if one omits latex_name in the declaration of phi, then everything is fine
- if one replaces latex_name by another argument like
  sage: phi = function('phi', nargs=2)
  then the same error appears

Is this a known bug? 

Eric.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/24d354ab-240b-4968-accc-ad2088b39106%40googlegroups.com.

Reply via email to