Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.

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.

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.