2021-11-23 19:42:12 UTC, Juan Luis Varona:
In recent versions of Sage, defining:
```
sage: t, x = SR.var('t, x')
sage: a = (5^x)^2-7*5^x+4
```
automatically groups exponents and gives:
```
sage: a
5^(2*x) - 7*5^x + 4
```
in which `5^x` is only seen once as such (old versions
of Sage possibly did not group exponents, thus keeping
two visible occurrences of `5^x` in the resulting `a`).
This means that only one `5^x` gets replaced
by `t` when we do the following substitution:
```
sage: aa = a.subs(5^x == t)
sage: aa
5^(2*x) - 7*t + 4
```
To work around this, we can instead think of
rewriting `x` as `log(t, 5)` as in the following
substitution, which gives the expected result:
```
sage: ab = a.subs(x == log(t, 5))
sage: ab
t^2 - 7*t + 4
```
Now we have a polynomial expression in t and
we can use corresponding tools. --Samuel