sagemath/sage-archive-2023-02-01

Substitution of variable doesn't always work when variable's name and representation are different

tomchor opened this issue · 2 comments

I recently started using Sagemath and I noticed this behavior:

>>> a1=var('a_1')
>>> E=x^a1
>>> E(a1=1)

 a₁
x  
>>> E(a_1=1)
x

Should this be the behavior? I feel like this is a bug and the correct way would be to indeed use E(a1=1) because that is the name of the variable, while a_1 is just its representation. For example, if I use Sympy's syntax it works as it should:

>>> E.subs({a1:1})
x

I'm using SageMath version 7.5.1 compiled for Linux Mint 18.1.

rwst commented

I think you're right, I have created a trac ticket:
https://trac.sagemath.org/ticket/23320
Please follow there. We don't use github yet for development so this issue will be closed.

Fair enough. Thanks.