-1

Can You give me the example of symmetric matrix 10 x 10.

Or if You know online symmetric matrix generator then give me the links. I tried to make this with Wolfram Mathematica but I did not find a solution

Thanks a lot !

Luchnik
  • 273

3 Answers3

2

Note that if $A$ is a square matrix, then $A+A^T$ is always symmetric where $T$ denotes transpose. In fact, $\frac{A+A^T}{2}$ is known as the symmetric part of $A$ (and $\frac{A-A^T}{2}$ the anti-symmetric part of $A$, and $A$ is the sum of its symmetric and antisymmetric parts).

In Matlab, you can use the following commands to get a random symmetric matrix:

A=randn(10); matrix=A+A.';

[Of course, diagonal matrices are always symmetric, so you could do diag(randn(10,1)) or something as well to get a diagonal matrix with random Gaussian entries on the diagonal].

There is also sprandsym in matlab if you want sparse random symmetric matrices.

Batman
  • 19,390
  • Thanks. but I haven't Matlab and I have no time to set up this. Can You use your software and post a couple of matrices here? Because I need only the examples – Luchnik May 09 '14 at 11:28
  • You can use Octave or Scilab - they are available freely in binary form for many platforms. You can also run that code here: http://lavica.fesb.hr/octave/octave-on-line_en.php – Batman May 09 '14 at 11:33
  • It gives me this http://fastpic.ru/view/63/2014/0509/807ff2be34fc3097203ad36dd3d4b948.jpg.html – Luchnik May 09 '14 at 11:56
  • If you're using Scilab, you may need: rand('normal'); A=rand(10,10); A+A.' – Batman May 09 '14 at 11:59
  • Are there a functions to generate matrix with integers not longer then 100 – Luchnik May 09 '14 at 12:02
  • Read the scilab manual or octave manual - for example, the randint function in Octave/Matlab, and note that the sum of two numbers between 0 and 50 is at most 100. – Batman May 09 '14 at 12:05
2

You can do this easily with pen and paper. The algorithm is the following

  1. Write down 10 numbers in a row
  2. Beneath the $i$-th number (counting from $1$), write down a column of $10-i$ numbers
  3. You've now found a lower triangular matrix
  4. Complete the matrix to a symmetric matrix by copying the $j$-th number in the $i$-th row (if there is already such a number) to the $i$-th column of the $j$-th row (if there isn't already a number there).
  5. Draw a large opening parenthesis to the left, and a large closing parenthesis to the right of your array of $10 \times 10$ numbers.
  6. Ponder the fact that you could have easily figured this out yourself, had you bothered to look up the definition of a symmetric matrix.

(6) is the most important part of the algorithm.

fgp
  • 21,050
0

I don't know whether it's useful for you but I remember a matlab code for generating random symmetric positive definite matrix given in How to generate random symmetric positive definite matrices using MATLAB?

user72272
  • 168
  • 1
  • 10
  • Thanks. but I haven't Matlab and I have no time to set up this. Can You use your software and post a couple of matrices here? Thanks – Luchnik May 09 '14 at 11:25