1

If I want to define a function f(n) that calculates the determinant of a n times n-matrix like the Vandermonde determinant containing n variables x1,...,xn what is a good way to define the variables as variables.

If I want to do it in advance, then I have to fix an arbitrary maximal number of n, if I do it inside the routine then they will be definied multiply.

Is there an elegant way to do say that x(i) should be a variable for all i?

4

1 回答 1

2

好吧,如果您使用该符号x || (1..10),您将生成十个名为 x1、...、x10 的符号。虽然我不太确定这实际上是你想要做的。

另一种方法是使用函数或符号关键字定义矩阵。例如:Matrix(3, 3, (i, j) -> alpha[i]^(j-1))创建一个 3x3 Vandermonde 矩阵并Matrix(4, 4, symbol=a)创建一个包含条目的 4x4 矩阵a[i, j]

我希望这有帮助。

于 2011-10-30T07:02:13.213 回答