Custom Matrix Generator
Generate custom matrices: identity, random, symmetric, sparse, triangular, Hadamard, Vandermonde. Export as CSV, JSON, LaTeX with properties.
About
Incorrect matrix construction introduces silent errors in linear systems, eigenvalue problems, and numerical simulations. A single transposition mistake in a 10ร10 coefficient matrix propagates through every downstream calculation. This tool generates matrices of arbitrary dimension with guaranteed structural properties: symmetry (A = AT), positive-definiteness constraints, controlled sparsity density ฯ, and exact rank. It computes trace, determinant (via LU decomposition), and rank (via Gaussian elimination with partial pivoting) on generation. Results export to CSV, JSON, and LaTeX bmatrix format.
The generator covers standard named matrices: Kronecker-delta identity In, Hadamard matrices H2k via Sylvester construction, Toeplitz matrices from a single generating vector, and Vandermonde matrices from node vectors. Random integer and float matrices accept explicit bounds [a, b]. Approximation note: determinant computation uses floating-point LU factorization. For matrices with entries exceeding 1015, expect rounding artifacts.
Formulas
The identity matrix uses the Kronecker delta function:
Hadamard matrices are built via Sylvester's recursive construction:
Vandermonde matrix entries follow the power rule:
Sparse matrix density ฯ controls the fraction of nonzero entries:
Determinant is computed via LU decomposition with partial pivoting. The determinant equals the product of pivot elements times the sign of the permutation:
Where s is the number of row swaps, uii are the diagonal entries of U in the factorization PA = LU. Rank is computed as the number of nonzero pivots with tolerance ฮต = 10โ10. Hilbert matrix entry: Hij = 1i + j โ 1.
Reference Data
| Matrix Type | Symbol | Key Property | Determinant | Rank | Eigenvalue Pattern | Use Case |
|---|---|---|---|---|---|---|
| Identity | In | Diagonal = 1 | 1 | n | All 1 | Basis, neutral element |
| Zero | O | All entries 0 | 0 | 0 | All 0 | Initialization |
| Ones | J | All entries 1 | 0 (n > 1) | 1 | n and 0s | Averaging, projections |
| Diagonal | diag(d) | Off-diag = 0 | โ di | Count nonzero di | di values | Scaling transforms |
| Upper Triangular | U | Below diag = 0 | โ uii | Count nonzero uii | uii values | LU factorization |
| Lower Triangular | L | Above diag = 0 | โ lii | Count nonzero lii | lii values | Cholesky decomposition |
| Symmetric | A = AT | Mirror across diagonal | Real | โค n | All real | Covariance matrices |
| Sparse | - | Density ฯ < 1 | Varies | Varies | Varies | Graph adjacency, FEM |
| Random Integer | - | Uniform [a, b] | Varies | Usually full | Varies | Monte Carlo, testing |
| Random Float | - | Uniform [a, b) | Varies | Usually full | Varies | Stochastic simulation |
| Hadamard | H2k | HHT = nI | ยฑnn/2 | n | ยฑโn | Signal processing, codes |
| Toeplitz | T | Constant diagonals | Varies | โค n | Varies | Convolution, time series |
| Vandermonde | V | Vij = xij | โ(xj โ xi) | n if distinct | Varies | Polynomial interpolation |
| Hilbert | Hij = 1i+jโ1 | Positive definite | Extremely small | n | All positive, tiny | Ill-conditioning tests |
| Permutation | P | One 1 per row/col | ยฑ1 | n | Roots of unity | Row swaps, shuffling |