Visualizing Tensors of Any Rank via Unit-Sphere Projection
Contents
Interactive Demo
Interactive Demo
Select a rank, choose a preset or edit the table directly, and the surface rebuilds live. The table shows the full $3^n$-component tensor with no symmetry assumed. Cell colours match the surface colorscale. The matrix equation displayed below the table shows the full matrix for rank 2 and uses reduced (Voigt) notation for ranks 3 and 4, assuming the standard index symmetries for those ranks.
Left-drag: orbit · Scroll: zoom · Right-drag: pan · Red axis = 1, Green = 2, Blue = 3
Theory
The unit-sphere projection
Given a tensor $T_{i_1 i_2 \cdots i_n}$ of rank $n$ and a unit direction $\hat{\mathbf{n}}$ with $\lVert\hat{\mathbf{n}}\rVert = 1$, define the directional scalar
\[r(\hat{\mathbf{n}}) = T_{i_1 i_2 \cdots i_n}\, n_{i_1} n_{i_2} \cdots n_{i_n}\]where Einstein summation is implied over all indices from 1 to 3. The projection surface is the locus of points $r(\hat{\mathbf{n}})\,\hat{\mathbf{n}}$ as $\hat{\mathbf{n}}$ sweeps the unit sphere. When $r$ can be negative, we instead plot $\lvert r(\hat{\mathbf{n}})\rvert\,\hat{\mathbf{n}}$ and encode the sign in colour.
At every direction $\hat{\mathbf{n}}$, all $3^n$ components participate in the sum. The resulting shape encodes the full directional response, not just values along the coordinate axes.
Discretisation
The sphere is sampled on a $128 \times 128$ grid in spherical coordinates $(\theta, \varphi)$:
\[\hat{\mathbf{n}} = \begin{pmatrix} \sin\theta\cos\varphi \\ \sin\theta\sin\varphi \\ \cos\theta \end{pmatrix}, \qquad \theta \in [0,\pi],\quad \varphi \in [0, 2\pi]\]Vertex normals are computed from adjacent-edge cross-products. Colour encodes $r(\hat{\mathbf{n}})$ on a blueβwhiteβred scale: blue at the minimum, red at the maximum, white at the midpoint. When all values are equal (isotropic case) the surface renders solid white. The sign-coloring mode maps positive $r$ to red and negative to blue regardless of magnitude.
Rank 2: quadratic directional indicator
The directional scalar is a quadratic form in $\hat{\mathbf{n}}$:
\[r(\hat{\mathbf{n}}) = T_{ij}\, n_i n_j\]Only the symmetric part of $\mathbf{T}$ contributes to this contraction, since $T_{ij} n_i n_j = \tfrac{1}{2}(T_{ij}+T_{ji})\,n_i n_j$; any antisymmetric part vanishes identically. For a positive-definite symmetric $\mathbf{T}$ the surface is an ellipsoid; the radial distance along each eigenvector equals the corresponding eigenvalue $\lambda_k$, and the semi-axes align with the eigenvectors. When $\mathbf{T}$ is indefinite, $r(\hat{\mathbf{n}})$ changes sign and sign-coloring reveals the lobes.
Examples:
- Cauchy stress tensor $\sigma_{ij}$: $r(\hat{\mathbf{n}}) = \sigma_{ij}\,n_i n_j$ is the normal component of the traction on the plane with outward normal $\hat{\mathbf{n}}$ (a scalar, not the traction vector itself).
- Thermal diffusivity tensor $\kappa_{ij}$: $r(\hat{\mathbf{n}})$ is the diffusivity in direction $\hat{\mathbf{n}}$.
- Moment of inertia tensor $I_{ij}$: $r(\hat{\mathbf{n}})$ is the second moment of mass about the axis $\hat{\mathbf{n}}$.
- Acoustic tensor $Q_{ik}(\hat{\mathbf{m}}) = C_{ijkl}\,m_j m_l$: $r(\hat{\mathbf{n}}) = Q_{ik}\,n_i n_k$ is the quadratic form of the acoustic tensor for polarisation direction $\hat{\mathbf{n}}$, given a fixed propagation direction $\hat{\mathbf{m}}$. Its three eigenvalues equal $\rho v^2$ for the three wave modes (divide by density for squared wave speeds).
- Ricci curvature tensor $R_{ij}$: $r(\hat{\mathbf{n}})$ is the Ricci curvature in the tangent direction $\hat{\mathbf{n}}$, used in differential geometry and general relativity.
Rank 3: cubic directional indicator
The directional scalar is a cubic form, which can be negative:
\[r(\hat{\mathbf{n}}) = T_{ijk}\, n_i n_j n_k\]Because the contraction involves an odd number of factors of $\hat{\mathbf{n}}$, the cubic form satisfies $r(-\hat{\mathbf{n}}) = -r(\hat{\mathbf{n}})$ for every rank-3 tensor, regardless of its index symmetries. Rendering $\lvert r\rvert\,\hat{\mathbf{n}}$ with sign-coloring shows both magnitude and polarity.
Examples:
- Piezoelectric tensor $d_{ijk}$: $r(\hat{\mathbf{n}})$ gives the electric polarization induced when stress is applied along $\hat{\mathbf{n}}$.
Rank 4: quartic directional indicator
The directional scalar is a quartic form:
\[r(\hat{\mathbf{n}}) = T_{ijkl}\, n_i n_j n_k n_l\]The quartic form is always even: $r(-\hat{\mathbf{n}}) = r(\hat{\mathbf{n}})$, so the surface has inversion symmetry. A general rank-4 tensor has $3^4 = 81$ components; the demo always uses all 81 with no symmetry imposed.
Isotropic check. The isotropic rank-4 tensor is
\[T_{ijkl} = \lambda\,\delta_{ij}\delta_{kl} + \mu\!\left(\delta_{ik}\delta_{jl} + \delta_{il}\delta_{jk}\right)\]Contracting fully with $\hat{\mathbf{n}}$:
\[T_{ijkl}\,n_i n_j n_k n_l = \lambda\underbrace{(n_i n_i)}_{1}\underbrace{(n_k n_k)}_{1} + 2\mu\underbrace{(n_i n_j n_i n_j)}_{1} = \lambda + 2\mu\]The result is constant in all directions, giving a perfect sphere. Any deviation signals directional dependence.
Examples:
- Elastic stiffness tensor $C_{ijkl}$: $r(\hat{\mathbf{n}})$ is the longitudinal modulus in direction $\hat{\mathbf{n}}$, i.e. the uniaxial-strain stiffness $C_{ijkl}\,n_i n_j n_k n_l$ (not to be confused with Youngβs modulus, which involves the compliance tensor).
- Eshelby tensor $S_{ijkl}$: the quartic contraction $S_{ijkl}\,n_i n_j n_k n_l$ encodes the directional dependence of the eigenstrain-to-total-strain relation for ellipsoidal inclusions in micromechanics.
Summary
Rank 2 ($T_{ij} n_i n_j$): quadratic form, ellipsoid for positive-definite $\mathbf{T}$, lobed when indefinite.
Rank 3 ($T_{ijk} n_i n_j n_k$): cubic form, odd under $\hat{\mathbf{n}} \to -\hat{\mathbf{n}}$ (a consequence of odd rank, not tensor symmetry); sign-coloring distinguishes positive and negative lobes.
Rank 4 ($T_{ijkl} n_i n_j n_k n_l$): quartic form with inversion symmetry, sphere for isotropic tensors.
Rank $n$ ($T_{i_1 i_2 \cdots i_n} n_{i_1} n_{i_2} \cdots n_{i_n}$): the same projection works for any rank. Even $n$ gives inversion-symmetric surfaces; odd $n$ requires sign-coloring. By the time you are working with rank-5 tensors and above, the visualisation is probably not your main concern, but it is perfectly possible. The surface will be a lumpy, blob-like shape with $3^n$ components all mixed together, and whatever structure it has will reflect the symmetry group of the tensor.
All $3^n$ components are used with no symmetry assumed.
Here is what a rank-10 tensor looks like. The tensor used has large off-axis cross terms so the dominant response is between the coordinate axes, breaking the axial lobe structure:
\[r(\hat{\mathbf{n}}) = w_1 n_1^4 n_2^3 n_3^3 + w_2 n_1^3 n_2^4 n_3^3 + w_3 n_1^3 n_2^3 n_3^4 + w_4 n_1^5 n_2^3 n_3^2 + w_5 n_1^2 n_2^5 n_3^3 + w_6 n_1^3 n_2^2 n_3^5 + w_7 n_1^{10} + w_8 n_2^{10} + w_9 n_3^{10}\]The weights $w_1,\ldots,w_9$ are adjustable via the sliders below. The result is a lumpy blob with no clean geometric interpretation.
Rank-10 tensor with mixed cross terms. Left-drag: orbit · Scroll: zoom
References
Tensor visualisation method
- Nye, J. F. (1957). Physical Properties of Crystals: Their Representation by Tensors and Matrices. Oxford University Press. Introduces the representation quadric, which is the rank-2 case of this method.
Material property values
- Landolt-BΓΆrnstein β Group III Condensed Matter. Springer. Comprehensive tabulations of elastic, piezoelectric, and other tensor properties for a wide range of materials. Available via SpringerMaterials.
Similar Software
- ElATools. Marmier, A. et al. (2010). Computer Physics Communications, 181(12), 2102β2115. https://doi.org/10.1016/j.cpc.2010.08.033
Basem Rajjoub