Documentation for TensND
Symbolic and numerical tensor calculations in arbitrary coordinate systems.
Introduction
TensND.jl is a Julia package for tensor calculations of any order and dimension in arbitrary coordinate systems. It supports both symbolic computation (via SymPy and Symbolics.jl) and numerical evaluation (via ForwardDiff automatic differentiation).
Key features
- Basis types: canonical, rotated, orthogonal, and fully general non-orthogonal bases
- Tensor algebra: products, contractions, change of basis, variance (covariant/contravariant) management
- Structured tensor types: isotropic (
TensISO), transversely isotropic (TensWalpole,TensTI), orthotropic (TensOrtho) with compact parametric storage and efficient algebra - Symmetry projection: find the closest ISO, TI, or ORTHO tensor via Frobenius distance minimization; rotation-optimized via NLopt
- Differential operators: gradient, symmetric gradient, divergence, Laplacian, Hessian in curvilinear coordinate systems (symbolic and numerical)
- Generic type system: works with
Float64, symbolic types (Sym,Num), andForwardDiff.Dualnumbers for automatic differentiation
The implementation is inspired by the Maple library Tens3d developed by Jean Garrigues.
Installation
The package can be installed with the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run:
pkg> add TensNDOr, equivalently, via the Pkg API:
julia> import Pkg; Pkg.add("TensND")For rotation-optimized tensor projections, also install the optional dependency:
pkg> add NLoptManual outline
Tutorials
- N-layer sphere
- Numerical differential operators
- Kelvin fundamental solution
- Tensor projection onto symmetry subspaces
Citing TensND.jl
@misc{TensND.jl,
author = {Jean-François Barthélémy},
title = {TensND.jl},
url = {https://github.com/jfbarthelemy/TensND.jl},
version = {v0.1.1},
year = {2021},
month = {8}
}Related packages
- SymPy.jl — symbolic mathematics via Python/PyCall
- Symbolics.jl — native Julia CAS (also supported)
- Tensors.jl — low-level tensor storage
- OMEinsum.jl — Einstein summation
- Rotations.jl — rotation matrices
- ForwardDiff.jl — automatic differentiation
- NLopt.jl — rotation-optimized projections (optional)
References
- Tens3d — Maple tensor library by Jean Garrigues
- Walpole basis decomposition — blog post by S. Brisard
- Hoenig, A. (1978). The behavior of a flat elliptical crack in an anisotropic elastic body. International Journal of Solids and Structures, 14, 925-934.