The `subs`

method for polynomials is **not** an analog of `SR.subs`

!

```
sage: a=SR.var("a")
sage: R1.<x>=SR[]
sage: R2.<y,z>=SR[]
sage: x.subs?
```

prints

```
Docstring:
Identical to "self(*x)".
See the docstring for "__call__()".
EXAMPLES:
sage: R.<x> = QQ[]
sage: f = x^3 + x - 3
sage: f.subs(x=5)
127
sage: f.subs(5)
127
sage: f.subs({x:2})
7
sage: f.subs({})
x^3 + x - 3
sage: f.subs({'x':2})
Traceback (most recent call last):
```

etc... Compare with :

```
sage: y.subs?
Signature: y.subs(fixed=None, **kw)
Docstring:
Fix some given variables in a given multivariate polynomial and
return the changed multivariate polynomials. The polynomial itself
is not affected. The variable, value pairs for fixing are to be
provided as a dictionary of the form "{variable: value}".
This is a special case of evaluating the polynomial with some of
the variables constants and the others the original variables.
INPUT:
* "fixed" - (optional) dictionary of inputs
* "**kw" - named parameters
OUTPUT: new "MPolynomial"
EXAMPLES:
sage: R.<x,y> = QQbar[] # optional - sage.rings.number_field
sage: f = x^2 + y + x^2*y^2 + 5 # optional - sage.rings.number_field
sage: f((5, y)) # optional - sage.rings.number_field
25*y^2 + y + 30
sage: f.subs({x: 5}) # optional - sage.rings.number_field
25*y^2 + y + 30
```

As far as I understand it, `(a*x).subs(a=1)`

should have raised an error.

Consider yelping on sage-support...

HTH,

The implementations are different. to clarify :

You may have discovered that the

`subs`

method of polynomial rings is buggy. You may explore this a bot further an open an issue, possibly after a yelp on sage-support...I take that back :

`subs`

isnotsupposed to do that in multivariate polynomials. I'll prepare an answer.To start with,

`a`

is not a polynomial variable in your example.Echoing @Max Alekseyev, I think that mixing symbolic variables with polynomials could be buggy. If you instead did

`R.<a,x,y> = SR[]`

, then`(a*x).subs(a=3)`

should return`3*x`

.