Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error when using non ASCII characters as symbolic function name

Since the adoption of Python 3, non ASCII characters can be used as identifiers in SageMath. So this is valid:

sage: π = pi
sage: def α(x):
....:     return cos(π*x)
sage: β = lambda x: x^3
sage: print(α(3)+β(3))
26

Such characters can be also used as symbolic variable names:

sage: δ = var("δ")
sage: expand((1+δ)^2)
δ^2 + 2*δ + 1

... or even as symbolic functions:

sage: μ = (x^2).function(x)
sage: μ
x |--> x^2
sage: μ(3)
9

However, if one tries to define the above symbolic function as usual, one gets an error:

sage: μ(x) = x^2
  File "<ipython-input-20-93337e923470>", line 1
    μ(x) = x**Integer(2)
                        ^
SyntaxError: can't assign to function call

I think that this is a bug, isn't it?