1
$\begingroup$

In Mathematica, we can find the value of a determinant with the built-in function Det. But how can I find the value of a determinant like this one?

$$ \left|\begin{array}{ccccc}1 & x & x^{2} & \cdots & x^{n-1} \\ 1 & a_{1} & a_{1}^{2} & \cdots & a_{1}^{n-1} \\ \vdots & \vdots & \vdots & & \vdots \\ 1 & a_{n-1} & a_{n-1}^{2} & \cdots & a_{n-1}^{n-1}\end{array}\right| $$

$\endgroup$
4
  • 2
    $\begingroup$ What is the question? Documentation for Det can be found here. $\endgroup$ Oct 5, 2020 at 8:49
  • 2
    $\begingroup$ This is a Vandermonde determinant. $\endgroup$
    – Roman
    Oct 6, 2020 at 10:14
  • $\begingroup$ Also asked and answered on Wolfram Community. $\endgroup$ Oct 6, 2020 at 13:59
  • 1
    $\begingroup$ Code-golfed answer $\endgroup$
    – Roman
    Oct 7, 2020 at 17:48

3 Answers 3

3
$\begingroup$

Making use of the observation that the OP is asking for a Vandermonde determinant:

With[{n = 5},
  Product[a[i]-a[j], {i, 0, n - 1}, {j, 0, i - 1}] /. a[0] -> x]

(*    (-x+a[1])(-x+a[2])(-a[1]+a[2])(-x+a[3])(-a[1]+a[3])(-a[2]+a[3])(-x+a[4])(-a[1]+a[4])(-a[2]+a[4])(-a[3]+a[4])    *)

This method is exponentially faster than actually building the matrix and calculating its determinant. Also, it is numerically more stable.

$\endgroup$
1
$\begingroup$
Clear["`*"];
n = 5;
v = Table[Subscript[a, i], {i, 0, n - 1}] /. Subscript[a, 0] -> x
m = Outer[Power, v, Range[0, n - 1]];
m // MatrixForm
m // Det // Simplify

enter image description here

$\endgroup$
0
$\begingroup$

Why should this not work? Maybe you have some syntax error? Here is an example:

n = 3;
(da = Transpose@
    Table[Prepend[Array[Subscript[a, #] &, n - 1], x]^i, {i, 0, 
      n - 1}]) // MatrixForm
Det[da]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.