x; y; p; q;
subst(Y/X,X,x)
substvec(x+y,[x,y],[1,x])

\\ #1321
v = [p + w*q, w*p + q] * Mod(1, w + 1);
substvec(x+y, [x, y], v)
\\ #1447
subst(O(x^2),x,0*x)
subst(x+O(x^2),x,Mod(1,3))
subst(x+O(x^2),x,Mod(0,3))
subst(1/x+O(x^2),x,Mod(0,3))
subst(2+x+O(x^2),x,Mod(0,3))
subst(Pol(0),x,Mod(1,3))
subst(Pol(0),x,Mod(1,3)*matid(2))
subst(Pol(1),x,Mod(1,3))
subst(Pol(1),x,Mod(1,3)*matid(2))

substpol(x,1/x,y)
substpol(Mod(x*y^2, y^3*x^2+1), y^2,y)
substpol(x*y^2/(y^3*x^2+1), y^2,y)
substpol(List(), y^2,y)
substpol(List(x^2*y^2), y^2,y)
substpol(x^2+y^3*x^3+O(x^4),y^2, y)

subst(1,x,[;])
subst(1,x,Mat([1,2]))
subst(x^2+x^3+O(x^4),x, 2*y+O(y^2))

substpol(1+O(x^2),x^2,x)
substpol(x^2+O(x^4),x^2,x)
substpol(x+O(x^4),x^2,x)
substpol(1,x^2,x)

\\#1727
substvec(1+x+y+x*y+O(x^2), [x,y],[x,y])

subst(Mod(1/z,y),z,x)
