DiagonalMatrix
A square matrix with list down the k-th diagonal (default the main diagonal), zero elsewhere.
✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram Language
DiagonalMatrix!DiagonalMatrix(list)an n×n matrix (n = Length(list)) with list on the main diagonalDiagonalMatrix(list, k)an (n + |k|)×(n + |k|) matrix with list on the k-th diagonal (k > 0 above, k < 0 below)Typed signatures
| Type | Package | Applies |
|---|---|---|
(list<any>, integer?) -> list<any> | combinatorics | always |
Details
- The result grows with k rather than staying n×n — Wolfram's own convention, kernel-checked (
DiagonalMatrix[{1, 2}, 1]is 3×3, not 2×2).
Examples
About
| Examples | 7 |
|---|---|
| Checked against | Wolfram Language 5 agree1 differ1 unevaluated |
| Crosswalk | Wolfram Language |
See also: HilbertMatrix