# Revision history [back]

### Substitution of variable in polynomial not working as expected.

R.<x> = SR[]
a = SR.var('a')
P = a*x
P.subs(a=1)


returns x, as expected, but

R.<x, y> = SR[]
a = SR.var('a')
P = a*x
P.subs(a=1)


returns a*x.

 2 None slelievre 17654 ●22 ●160 ●348 http://carva.org/samue...

### Substitution of variable in polynomial not working as expected.

The subs method behaves differently in two related settings:

• univariate polynomials over SR
• multivariate polynomials over SR

when trying to substitute a value for some variable involved as a coefficient.

In the univariate case:

R.<x> = SR[]
a = SR.var('a')
P = a*x
P.subs(a=1)


returns x, x, as expected, but expected.

But in the multivariate case:

R.<x, y> = SR[]
a = SR.var('a')
P = a*x
P.subs(a=1)


returns a*x. a*x.

 3 retagged slelievre 17654 ●22 ●160 ●348 http://carva.org/samue...

### Substitution of variable in polynomial not working as expected.

The subs method behaves differently in two related settings:

• univariate polynomials over SR
• multivariate polynomials over SR

when trying to substitute a value for some variable involved as a coefficient.

In the univariate case:

R.<x> = SR[]
a = SR.var('a')
P = a*x
P.subs(a=1)


returns x, as expected.

But in the multivariate case:

R.<x, y> = SR[]
a = SR.var('a')
P = a*x
P.subs(a=1)


returns a*x.