Maple 中使用矩阵的递归关系
Recurrence relations in Maple using Matrices
正如标题所暗示的那样,我正在 maple 中做一个涉及使用循环的项目。
作为前任。假设我们有一个名为 A 的 3x3 矩阵,我们将它乘以 3x1(B),然后将其添加到 3x1(C) 中,得到的矩阵用作新的 B 然后我们做同样的操作。我将如何在 maple 中执行此操作?
你可以用 procedure:
recurrence := proc(A,b,c,n)
## A is a k x k matrix
## b is a 1 x k vector
## c is a 1 x k vector
## n is the number of iterations
local btemp, i;
btemp := b;
for i to n do
btemp := A.btemp+c;
end do;
end proc:
使用示例:
A:= <<1,4,7>|<2,5,8>|<3,6,9>>;
b:=<1/10,1/10,1/10>;
c:=<-1,2,-2>;
seq(recurrence(A,b,c,n),n = 1..3); ## Output the recurrence for 1,2 and 3 iterations
正如标题所暗示的那样,我正在 maple 中做一个涉及使用循环的项目。
作为前任。假设我们有一个名为 A 的 3x3 矩阵,我们将它乘以 3x1(B),然后将其添加到 3x1(C) 中,得到的矩阵用作新的 B 然后我们做同样的操作。我将如何在 maple 中执行此操作?
你可以用 procedure:
recurrence := proc(A,b,c,n)
## A is a k x k matrix
## b is a 1 x k vector
## c is a 1 x k vector
## n is the number of iterations
local btemp, i;
btemp := b;
for i to n do
btemp := A.btemp+c;
end do;
end proc:
使用示例:
A:= <<1,4,7>|<2,5,8>|<3,6,9>>;
b:=<1/10,1/10,1/10>;
c:=<-1,2,-2>;
seq(recurrence(A,b,c,n),n = 1..3); ## Output the recurrence for 1,2 and 3 iterations