MatrixPattern.py is a Python script that generates square matrices representing linear or cyclical connectivity patterns. These matrices are commonly used in:
- Quantum chemistry
- Solid-state physics
- Tight-binding models
- Graph theory (adjacency matrices)
The script also integrates with Wolfram Alpha by generating clickable links that allow users to perform symbolic computations such as eigenvalue analysis and matrix diagonalization.
- Generate linear (chain) matrices
- Generate cyclical (ring) matrices
- Output matrix in Wolfram-compatible format
- Automatically generate links for:
- Eigenvalues
- Diagonalization
- Orthogonal diagonalization
No external dependencies are required.
Make sure you have Python installed (version 3.x recommended).
Run the script:
python MatrixPattern.pyYou will be prompted to enter:
-
n→ size of the matrix (integer) -
matrix type:
linearcyclical
Enter the size of the matrix (n): 4
Is the matrix linear or cyclical? cyclical
Generated Matrix:
0 1 0 1
1 0 1 0
0 1 0 1
1 0 1 0
Wolfram Matrix Format:
{{0,1,0,1},{1,0,1,0},{0,1,0,1},{1,0,1,0}}
Wolfram Alpha Links:
Eigenvalues:
https://www.wolframalpha.com/input?i=...
Diagonalization:
https://www.wolframalpha.com/input?i=...
Orthogonal Eigenvectors:
https://www.wolframalpha.com/input?i=...
Represents a chain structure where each element connects only to its nearest neighbors.
Example (n = 4):
0 1 0 0
1 0 1 0
0 1 0 1
0 0 1 0
Represents a ring structure where the first and last elements are also connected.
Example (n = 4):
0 1 0 1
1 0 1 0
0 1 0 1
1 0 1 0
The script generates links that allow you to instantly analyze the matrix in Wolfram Alpha.
- Eigenvalues
- Diagonalization
- Orthogonal diagonalization
This enables:
- Spectral analysis
- Basis transformations
- Exploration of quantum/physical systems
- Tight-binding Hamiltonians
- Lattice models
- Graph adjacency matrices
- Discrete Laplacians
- Eigenvalue problems in physics and engineering
- Add NumPy support for local eigenvalue computation
- Graph visualization (networkx)
- Export to Mathematica notebook format
- Support weighted matrices
This project is open source and free to use.