2

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

Jasmine
  • 1,225
  • 3
  • 10
  • 1
    n = 10 ; a = RandomReal[{0.0, 1.0}, {n, n}] ; b = 0.5*(a - Transpose[a]) ; AntisymmetricMatrixQ[b] – I.M. Aug 03 '21 at 04:09
  • @DavidG.Stork Nop – Jasmine Aug 03 '21 at 04:15
  • 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. – Michael Seifert Aug 03 '21 at 13:42

3 Answers3

5

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)

rfrasier
  • 592
  • 3
  • 12
3

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

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

AntisymmetricMatrixQ[result] (* True *) ```

tueda
  • 793
  • 3
  • 6
2

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

Normal @ SymmetrizedArray[
  RandomInteger[10, {3, 3}],
  Automatic,
  Antisymmetric[{1, 2}]
]
Sjoerd Smit
  • 23,370
  • 46
  • 75