### 2.42.13  Modify an element or a row of a matrix : subsop

subsop modifies an element or a row of a matrix. It is used mainly for Maple and MuPAD compatibility. Unlike := or =<, it does not require to store the matrix in a variable.
subsop takes two or three arguments, these arguments are permuted in Maple mode.

1. Modify an element
• In Xcas mode, the first index is 0
subsop has two (resp three) arguments: a matrix A and an equality [r,c]=v (resp a matrix A, a list of index [r,c], a value v).
subsop replaces the element A[r,c] by v.
Input in Xcas mode :
subsop([[4,5],[2,6]],[1,0]=3)
Or :
subsop([[4,5],[2,6]],[1,0],3)
Output :
[[4,5],[3,6]]
Remark
If the matrix is stored in a variable, for example A:=[[4,5],[2,6]], it is easier to input A[1,0]:=3 which modifies A into the matrix
[[4,5],[3,6]].
• In Mupad, TI mode, the first index is 1
subsop has two (resp three) arguments: a matrix A and an equality [r,c]=v (resp a matrix A, a list of index [r,c], a value v).
subsop replaces the element A[r,c] by v.
Input in Mupad, TI mode :
subsop([[4,5],[2,6]],[2,1]=3)
Or :
subsop([[4,5],[2,6]],[2,1],3)
Output :
[[4,5],[3,6]]
Remark
If the matrix is stored in a variable, for example A:=[[4,5],[2,6]], it is easier to input A[2,1]:=3 which modifies A into the matrix
[[4,5],[3,6]].
• In Maple mode, the arguments are permuted and the first index is 1
subsop has two arguments: an equality [r,c]=v and a matrix A.
subsop replaces the element A[r,c] by v.
Input in Maple mode
subsop([2,1]=3,[[4,5],[2,6]])
Output :
[[4,5],[3,6]]
Remark
If the matrix is stored in a variable, for example A:=[[4,5],[2,6]], it is easier to input A[2,1]:=3 which modifies A into the matrix
[[4,5],[3,6]].
2. Modify a row
• in Xcas mode, the first index is 0
subsop takes two arguments : a matrix and an equality (the index of the row to be modified, the = sign and the new row value).
Input in Xcas mode :
subsop([[4,5],[2,6]],1=[3,3])
Output :
[[4,5],[3,3]]
Remark
If the matrix is stored in a variable, for example A:=[[4,5],[2,6]], is is easier to input A[1]:=[3,3] which modifies A into the matrix
[[4,5],[3,3]].
• In Mupad, TI mode, the first index is 1
subsop takes two arguments : a matrix and an equality (the index of the row to be modified, the = sign and the new row value).
Input in Mupad, TI mode :
subsop([[4,5],[2,6]],2=[3,3])
Output :
[[4,5],[3,3]]
Remark
If the matrix is stored in a variable, for example A:=[[4,5],[2,6]], it is easier to input A[2]:=[3,3] which modifies A into the matrix
[[4,5],[3,3]].
• in Maple mode, the arguments are permuted and the first index is 1 :
subsop takes two arguments : an equality (the index of the row to be modified, the = sign and the new row value) and a matrix.
Input in Maple mode :
subsop(2=[3,3],[[4,5],[2,6]])
Output :
[[4,5],[3,3]]
Remark
If the matrix is stored in a variable, for example A:=[[4,5],[2,6]], it is easier to input A[2]:=[3,3] which modifies A into the matrix
[[4,5],[3,3]].

Remark
Note also that subsop with a ’n=NULL’ argument deletes row number n. In Xcas mode input :

subsop([[4,5],[2,6]],’1=NULL’)

Output :

[[4,5]]