# Singular

#### 7.10.6.22 ncrepSubstitute

Procedure from library `ncrat.lib` (see ncrat_lib).

Usage:
ncrep s = ncrepSubstitute(q, l);
q of type ncrep, vars = (x1, ..., xg),
points = (A1, ... , Ag) with Ai matrices of the
same dimension and xi of type poly are nc variables

Return:
substitutes in Ai for xi in q

Example:
 ```LIB "ncrat.lib"; ncInit(list("x", "y", "z")); ncrat f = ncratFromString("x+y"); ncrep q = ncrepGet(f); matrix A[2][2] = 1, 2, 3, 4; matrix B[2][2] = 5, 6, 7, 8; ncrep s = ncrepSubstitute(q, list(x, y), list(A, B)); print(q); ==> lvec= ==> 0,1,0,1 ==> ==> mat= ==> x, -1,0, 0, ==> -1,0, 0, 0, ==> 0, 0, y, -1, ==> 0, 0, -1,0 ==> ==> rvec= ==> 0, ==> 1, ==> 0, ==> 1 print(s); ==> lvec= ==> 0,0,1,0,0,0,1,0, ==> 0,0,0,1,0,0,0,1 ==> ==> mat= ==> 1, 2, -1,0, 0, 0, 0, 0, ==> 3, 4, 0, -1,0, 0, 0, 0, ==> -1,0, 0, 0, 0, 0, 0, 0, ==> 0, -1,0, 0, 0, 0, 0, 0, ==> 0, 0, 0, 0, 5, 6, -1,0, ==> 0, 0, 0, 0, 7, 8, 0, -1, ==> 0, 0, 0, 0, -1,0, 0, 0, ==> 0, 0, 0, 0, 0, -1,0, 0 ==> ==> rvec= ==> 0,0, ==> 0,0, ==> 1,0, ==> 0,1, ==> 0,0, ==> 0,0, ==> 1,0, ==> 0,1 ```