[Question]
  [
Given a vector of \$n\$ values \$(x\_1,x\_2,x\_3,\ldots,x\_n)\$ return the determinant of the corresponding [Vandermonde matrix](https://en.wikipedia.org/wiki/Vandermonde_matrix)
\$V(x\_1, x\_2, \ldots, x\_n) = \begin{bmatrix}1 & x\_1 & x\_1^2 & x\_1^3 & \ldots &x\_1^{n-1} \\1 & x\_2 & x\_2^2 & x\_2^3 & \ldots &x\_2^{n-1} \\ \vdots & & & \vdots & & \vdots \\ 1 & x\_n & x\_n^2 & x\_n^3 & \ldots & x\_n^{n-1}\end{bmatrix}\$.
This determinant can be written as:
\$\det V(x\_1, x\_2, \ldots x\_n) = \prod\_\limits{1 \leqslant i < j \leqslant n} (x\_j - x\_i)\$
### Details
Your program/function has to accept a list of floating point numbers in any convenient format that allows for a variable length, and output the specified determinant.
You can assume that the input as well as the output is within the range of the values your language supports. If you language does not support floating point numbers, you may assume integers.
### Some test cases
Note that whenever there are two equal entries, the determinant will be `0` as there are two equal rows in the corresponding Vandermonde matrix. Thanks to @randomra for pointing out this missing testcase.
```
[1,2,2,3]            0 
[-13513]             1
[1,2]                1
[2,1]               -1
[1,2,3]              2
[3,2,1]             -2
[1,2,3,4]           12
[1,2,3,4,5]        288
[1,2,4]              6
[1,2,4,8]         1008
[1,2,4,8,16]  20321280
[0, .1, .2,...,1]   6.6586e-028
[1, .5, .25, .125]  0.00384521
[.25, .5, 1, 2, 4]  19.3798828
```
  
[Answer]
# Jelly, 5 bytes
```
œc2IP
```
`œc2` gets all combinations without replacement of length 2. `I` computes the difference list of each of those pairs, yielding a list like `[[1], [2], [3], ..., [1]]`. We take the `P`roduct.
[Try it here!](https://tio.run/##y0rNyan8///o5GQjz4D///9H6xmZ6uiZ6hjqGOmYxAIA)
---
In modern Jelly, `Œc` works as a short form of `œc2`, so `ŒcIP` is a 4-byte solution.
[Answer]
# Mathematica, 30 bytes
```
1##&@@(#2-#&@@@#~Subsets~{2})&
```
This is an anonymous function.
Expanded by Mathematica, it is equivalent to `(1 ##1 & ) @@ Apply[#2 - #1 & , Subsets[#1, {2}], {1}] &`. `1##&` is an equivalent for `Times` (thanks tips page), which is applied to each distinct pair of elements from the input list, generated by `Subsets[list, {2}]`. Note that `Subsets` does not check for uniqueness of elements.
[Answer]
# Ruby, ~~49~~ 47 bytes
```
->x{eval(x.combination(2).map{|a,b|b-a}*?*)||1}
```
This is a lambda function that accepts a real valued, one-dimensional array and returns a float or an integer depending on the type of the input. To call it, assign it to a variable then do `f.call(input)`.
We get all combinations of size 2 using `.combination(2)` and get the differences for each pair using `.map {|a, b| b - a}`. We join the resulting array into a string separated by `*`, then `eval` this, which returns the product. If the input has length 1, this will be `nil`, which is falsey in Ruby, so we can just `||1` at the end to return 1 in this situation. Note that this still works when the product is 0 because for whatever reason 0 is truthy in Ruby.
[Verify all test cases online](https://repl.it/BtEQ/1)
Saved 2 bytes thanks to Doorknob!
[Answer]
## J, 13 bytes
```
-/ .*@(^/i.)#
```
This is a monadic function that takes in an array and returns a number.
Use it like this:
```
  f =: -/ .*@(^/i.)#
  f 1 2 4
6
```
## Explanation
I explicitly construct the Vandermonde matrix associated with the input array, and then compute its determinant.
```
-/ .*@(^/i.)#   Denote input by y
            #   Length of y, say n
         i.     Range from 0 to n - 1
       ^/       Direct product of y with the above range using ^ (power)
                This gives the Vandermonde matrix
                 1 y0     y0^2     ... y0^(n-1)
                 1 y1     y1^2     ... y1^(n-1)
                   ...
                 1 y(n-1) y(n-1)^2 ... y(n-1)^(n-1)
-/ .*           Evaluate the determinant of this matrix
```
[Answer]
# [MATL](https://esolangs.org/wiki/MATL), 9
```
!G-qZRQpp
```
[**Try it online!**](http://matl.tryitonline.net/#code=IUctcVpSUXBw&input=WzEsMiw0LDgsMTZd)
This computes a matrix of all differences and then keeps only the part below the main diagonal, making the other entries `1` so they won't affect the product. The lower triangular function makes the unwanted elements `0`, not `1`. So we subtract `1`, take the lower triangular part, and add `1` back. Then we can take the product of all entries.
```
t     % take input. Transpose
G     % push input again
-     % subtract with broadccast: matrix of all pairwise differences
q     % subtract 1
ZR    % make zero all values on the diagonal and above
Q     % add 1
p     % product of all columns
p     % product of all those products
```
[Answer]
## Pyth, ~~15~~ ~~13~~ ~~12~~ 11 bytes
```
*F+1-M.c_Q2
```
```
         Q    take input (in format [1,2,3,...])
        _     reverse the array: later we will be subtracting, and we want to
                subtract earlier elements from later elements
      .c  2   combinations of length 2: this gets the correct pairs
    -M        map a[0] - a[1] over each subarray
  +1          prepend a 1 to the array: this does not change the following
                result, but prevents an error on empty array
*F            fold over multiply (multiply all numbers in array)
```
Thanks to [@FryAmTheEggman](https://codegolf.stackexchange.com/users/31625) and [@Pietu1998](https://codegolf.stackexchange.com/users/30164/pietu1998) for a byte each!
[Answer]
# Mathematica, 32 bytes
```
Det@Table[#^j,{j,0,Length@#-1}]&
```
I was surprised not to find a builtin for Vandermonde stuff. Probably because it's so easy to do it oneself.
This one explicitly constructs the transpose of a VM and takes its determinant (which is of course the same as the original's). This method turned out to be significantly shorter than using any formula I know of.
[Answer]
## Haskell, 34 bytes
```
f(h:t)=f t*product[x-h|x<-t]
f _=1
```
A recursive solution. When a new element `h` is prepended to the front, the expression is multiplied by the product of `x-h` for each element `x` of the list. Thanks to Zgarb for 1 byte.
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 19 bytes
```
{×/-∊(⍳≢⍵)↓¨↓∘.-⍨⍵}
```
Dfn producing the pairs, then taking the product.
`↓∘.-⍨⍵` all pairs (with repeats)
`(⍳≢⍵)` range from 1 to the length of the input
`↓¨` drop 1 2 3 4... elements to avoid repeats
`-∊` flatten and negate
`×/` take the product
[Try it online!](https://tio.run/##TYw9CsJAFIT7nGJKLfJ0dxP/bhPNRsHFiEZUxFaiEBAstLGxsrMQL6A3eReJq1GUxxu@GZgJhsYN54GJu66eJXoQ6jDPI15tF499xeV0U@LsyusTZ7cyr3b3sxVOD@RydrbZMnfyCALSnnI4OyLC/SKULxSm8ag/hok7gTFztCcJBnGCnh5ptErOu2VVQhRs@xHUv4f3I/gf/mYeGj@CqFlTBQmQBCmQB/JBNVAd1AA1P6uvUNoX8rX3Rr8YeQI "APL (Dyalog Extended) – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), ~~12 9~~ 8 bytes
```
ΠṁhṠzM-ḣ
```
[Try it online!](https://tio.run/##ASMA3P9odXNr///OoOG5gWjhuaB6TS3huKP///9bMSwyLDMsNCw1XQ "Husk – Try It Online")
(Apparently the only one of the three which was correct)
-3 bytes by calculating difference instead of pairs.
-1 from Jo King
## Explanation
```
ΠṁhṠzM-ḣ
   Ṡz    zip the input with
       ḣ prefixes
     M-  subtract the input from each
 ṁh      remove first element of each, join
Π        product
```
[Answer]
# Matlab, 26 bytes
(noncompeting)
Straightforward use of builtins. Note that (once again) Matlab's `vander` creates Vandermonde matrices but with the order of the rows flipped.
```
@(v)det(fliplr(vander(v)))
```
[Answer]
# Perl, 38 ~~41~~ bytes
Include +1 for `-p`
Give the numbers on a line on STDIN. So e.g. run as 
```
perl -p vandermonde.pl <<< "1 2 4 8"
```
Use an evil regex to get the double loop:
`vandermonde.pl`:
```
$n=1;/(^| ).* (??{$n*=$'-$&;A})/;*_=n
```
[Answer]
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 35 bytes
```
a->matdet(matrix(#a,,i,j,a[i]^j--))
```
[Try it online!](https://tio.run/##TYxBCsIwEEWvEuomgZ/BJI3Whb1IqTCglRSVULrQ09ektVKGYd77DD/yEPQ9Tp04T6zrJ4/X2yjTGcJb7hgI6MFNaC@91kpNHOPjI1noWsQhvMaERZZCdJKVgmgaA5vGtYm1cd7MlMJ8LMzPlgeHbYJyg/Cr/NMS1QZhDtn2IAOyIAcqQR50AB1BFei0dufUpjV2Lp3ZY@lu1fQF "Pari/GP – Try It Online")
[Answer]
## Rust, 86 bytes
```
|a:Vec<f32>|(0..a.len()).flat_map(|x|(x+1..a.len()).map(move|y|y-x)).fold(1,|a,b|a*b);
```
Rust, verbose as usual...
Explanation will come later (it's pretty straightforward, though).
[Answer]
## Haskell, 53 bytes
```
 f x=product[x!!j-x!!i|j<-[1..length x-1],i<-[0..j-1]]
```
Usage example: `f [1,2,4,8,16]` -> `20321280`.
Go through the indices `j` and `i` in a nested loop and make a list of the differences of the elements at position `j` and `i`. Make the product of all elements in the list.
Other variants that turned out to be slightly longer:
`f x=product[last l-i|l<-scanl1(++)$pure<$>x,i<-init l]`, 54 bytes
`import Data.List;f i=product[y-x|[x,y]<-subsequences i]`, 55 bytes
[Answer]
## CJam, 16 bytes
```
1l~{)1$f-@+:*\}h
```
In response to [A Simmons' post](https://codegolf.stackexchange.com/a/74972/21487), despite CJam's lack of a combinations operator, yes it is possible to do better :)
-1 byte thanks to @MartinBüttner.
[Try it online](http://cjam.aditsu.net/#code=1l~%7B%291%24f-%40%2B%3A*%5C%7Dh&input=%5B1%202%203%204%205%5D) | [Test suite](http://cjam.aditsu.net/#code=e%23%20Executes%20the%20program%2014%20times%20for%2014%20test%20cases%2C%0Ae%23%20printing%20the%20result%20after%20each%0A%0A14%7B%0A%0A1l~%7B%291%24f-%40%2B%3A*%5C%7Dh%0A%0A%5DoNo%7D*&input=%5B-13513%5D%0A%5B1%202%5D%0A%5B2%201%5D%0A%5B1%202%203%5D%0A%5B3%202%201%5D%0A%5B1%202%203%204%5D%0A%5B1%202%203%204%205%5D%0A%5B1%202%204%5D%0A%5B1%202%204%208%5D%0A%5B1%202%204%208%2016%5D%0A%5B0%20.1%20.2%20.3%20.4%20.5%20.6%20.7%20.8%20.9%201%5D%0A%5B1%20.5%20.25%20.125%5D%0A%5B.25%20.5%201%202%204%5D%0A%5B1%202%202%203%5D)
```
1                   Push 1 to kick off product
 l~                 Read and evaluate input V
   {          }h    Do-while loop until V is empty
    )                 Pop last element of V
     1$               Copy the prefix
       f-             Element-wise subtract each from the popped element
         @+           Add the current product to the resulting array
           :*         Take product to produce new product
             \        Swap, putting V back on top
```
[Answer]
## JavaScript (ES6), 61 bytes
```
a=>a.reduce((p,x,i)=>a.slice(0,i).reduce((p,y)=>p*(x-y),p),1)
```
I tried an array comprehension (Firefox 30-57) and it was 5 bytes longer:
```
a=>[for(i of a.keys(p=1))for(j of Array(i).keys())p*=a[i]-a[j]]&&p
```
The boring nested loop is probably shorter though.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 6 bytes
```
η-€¨˜P
```
[Try it online!](https://tio.run/##yy9OTMpM/f//3HbdR01rDq04PSfg//9oQx0jHWMdEx3TWAA "05AB1E – Try It Online")
**Commented**:
```
η         # prefixes of the input
 -        # subtract those from the input
  €       # for each sublist:
   ¨      #   remove the last element (i=j)
    ˜     # flatten the list
     P    # take the product
```
There are a few alternatives at the same length, such as [`ηõš-˜P`](https://tio.run/##yy9OTMpM/f//3PbDW48u1D09J@D//2hDHSMdYx0THdNYAA).
[Answer]
# [Desmos](https://www.desmos.com/calculator), 10+39=49 bytes
```
n=a.length
\prod_{i=1}^n\prod_{j=i+1}^n(a[j]-a[i])
```
[View it in Desmos](https://www.desmos.com/calculator/byvx36hbva)
There's not a lot to be golfed here other than "caching" `a.length` in an array, but I would like to point out that Desmos can handle the `...` notation in arrays!
[Answer]
# [Japt](https://github.com/ETHproductions/japt) v1.4.5, 8 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
à2 ®rnÃ×
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.5&code=4DIgrnJuw9c&input=WwpbMSwyLDIsM10KWy0xMzUxM10KWzEsMl0KWzIsMV0KWzEsMiwzXQpbMywyLDFdClsxLDIsMyw0XQpbMSwyLDMsNCw1XQpbMSwyLDRdClsxLDIsNCw4XQpbMSwyLDQsOCwxNl0KWzAsLjEsLjIsLjMsLjQsLjUsLjYsLjcsLjgsLjksMV0KWzEsLjUsLjI1LC4xMjVdClsuMjUsLjUsMSwyLDRdCl0tbVI) (includes all test cases)
```
à2 ®raÃ×     :Implicit input of array
à2           :Combinations of length 2 (using v1.4.5 avoids a bug here in later versions)
   ®         :Map
    r        :  Reduce by
     n       :  Inverse subtraction
      Ã      :End map
       ×     :Reduce by multiplication
```
[Answer]
# [Python 3](https://docs.python.org/3/), 91 bytes (does NOT work yet)
```
lambda x:eval("*".join([str(b-a) for a,b in combinations(x,2)]))or 1
from itertools import*
```
[Try it online!](https://tio.run/##DcsxDgIhEEDR3lNMtoINkixqY@JJVotBlzgGGAITs54eKX718stP3pxPPdzuPWLyL4T9un0xqmme7Icpq7VJVf6IGgJXQOOBMjw5ecooxLmp3Tj90HrocgiVE5BsVZhjA0qFq8y9VMqiglqtuxiwo8WAM3AeX@9/ "Python 3 – Try It Online")
Port of [Alex A.](https://codegolf.stackexchange.com/a/74795/109916)'s answer.
Fixing currently.
[Answer]
# [Factor](https://factorcode.org) + `math.matrices math.matrices.laplace`, 45 bytes
```
[ dup length vandermonde-matrix determinant ]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=ZYwxCsJAFER7TzEXyILBgOgBxMZG0igWn90fE9xs1s2PKOJJbNKYO-U2Lqa0ecMMzHsPBWlpQj8e8v12t1nhwsGxRcvXjp3mFjVJqSJC9deUJW9JM3xgkYcPlROsZ0-oNIPKMEeKBV6fTopkOSZHmM7DsjtLiRs5w6FuIpOf7w7DEpfKUbScptOgyVqoqfT9lF8)
[Answer]
# CJam, 32 bytes
```
1q~La\{1$f++}/{,2=},{~-}%~]La-:*
```
I'm sure someone can golf this better in CJam... The main issue is that I can't see a good way of getting the subsets so that uses up most of my bytes. This generates the power set (using an idea by Martin Büttner) and then selects the length-2 elements.
[Answer]
# [R](https://www.r-project.org/), 41 bytes
```
function(v)det(outer(v,1:sum(v|1)-1,"^"))
```
[Try it online!](https://tio.run/##K/ofpmCj@z@tNC@5JDM/T6NMMyW1RCO/tCS1SKNMx9CquDRXo6zGUFPXUEcpTklT83@YRrKGoY4REBpranKFaegaGpsaGoNYxamFGgY6hjpJlbYGeoZgSaM4DV0jKyOgNgA "R – Try It Online")
I was surprised not to see an R answer here!
[Answer]
# [Perl 5](https://www.perl.org/) `-pa`, 36 bytes
```
$\=1;map$\*=$q-$_,@F while$q=pop@F}{
```
[Try it online!](https://tio.run/##K0gtyjH9/18lxtbQOjexQCVGy1alUFclXsfBTaE8IzMnVaXQtiC/wMGttvr/f0MFIwUTBYt/@QUlmfl5xf91CxIB "Perl 5 – Try It Online")
[Answer]
# [Arn](https://github.com/ZippyMagician/Arn), [27 bytes](https://github.com/ZippyMagician/Arn/wiki/Carn)
```
ùW®š¡'‡ùHÓáâ§○iò;êñ⁺bì&B"$7
```
[Try it!](https://zippymagician.github.io/Arn?code=Knsqdnt2LTp7fVwue31cW18gX3sue30tPi0tKCg6cykj&input=MC4yNSAwLjUgMSAyIDQ=)
# Explained
Unpacked: `*{*v{v-:{}\.{}\[_ _{.{}->--((:s)#`
```
* ... \                  % Fold with multiplication after mapping
  {                      % Begin block
    * ... \
      v{                 % Block with key of `v`
          v              % Variable with identifier `v`
        -                % Minus
            _            % Variable intialized to STDIN; implied
          :{             % Head
      }                  % End block
              _          % Implied
            .{           % Beheaded
  }
        [                % Begin sequence
          _              % Entry equal to STDIN
          _{             % Block with key of `_` (needed otherwise the first `_` will be grabbed)
              _          % Last entry; implied
            .{           % Beheaded
          }
          ->             % Of length
            --           % Reduced by one
              (          % Begin expression
                  (
                      _  % Implied
                    :s   % Split on spaces
                  )      % End expression
                #        % Length
              )          % Implied
        ]                % End of sequence; implied
```
Had to fix a few major bugs I only found because of this challenge! Also made me consider adding a few quality of life features (including an upgrade to precedence and `#` automatically casting to a vector).
Speaking of bugs, I am 100% certain this works on the downloadable version, and it should be working on the online version very soon.
]