2
$\begingroup$

Is there a way to create random real antisymmetric matrix in Mathematica. Please see the example of such a matrix. cc

$\endgroup$
3
  • 1
    $\begingroup$ n = 10 ; a = RandomReal[{0.0, 1.0}, {n, n}] ; b = 0.5*(a - Transpose[a]) ; AntisymmetricMatrixQ[b] $\endgroup$
    – I.M.
    Commented Aug 3, 2021 at 4:09
  • $\begingroup$ @DavidG.Stork Nop $\endgroup$
    – Jasmine
    Commented Aug 3, 2021 at 4:15
  • $\begingroup$ How do you want the entries distributed? The simplest option would be a uniform distribution between some upper bound & lower bound for all of the independent entries, but other options exist. $\endgroup$ Commented Aug 3, 2021 at 13:42

3 Answers 3

5
$\begingroup$

Here's a version which allows you to specify a distribution and only generates the required number of random draws for a symmetric matrix. You could replace the RandomVariate[...] code with something like RandomInterger[] if you'd like.

(*Dimension*)
n = 3;

(*Distribution*)
dist = NormalDistribution[];

(*Construct upper triangular SparseArray, efficiently only creating n*(n-1)/2 random numbers.*)
s = SparseArray[{i_, j_} /; i < j :> RandomVariate[dist], {n, n}];

(*Create antisymmetric matrix.*)
m = Normal[s - Transpose[s]];

AntisymmetricMatrixQ[m]
(*True*)
$\endgroup$
3
$\begingroup$

If you don't mind the distribution of generated matrices:

m = RandomInteger[{0, 50}, {3, 3}];
result = m - Transpose[m]

AntisymmetricMatrixQ[result]  (* True *)
```
$\endgroup$
2
$\begingroup$

You can use SymmetrizedArray to create arrays with any kind of symmetry:

Normal @ SymmetrizedArray[
  RandomInteger[10, {3, 3}],
  Automatic,
  Antisymmetric[{1, 2}]
]
$\endgroup$

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