Skip to content

Installation

TensND is registered in the Julia General registry.

julia
julia> import Pkg; Pkg.add("TensND")

or, from the Pkg REPL mode (]):

julia
pkg> add TensND

Optional dependency

The orientation search of proj_tens and best_sym_tens — finding the transversely isotropic axis or the orthotropic frame when it is not known in advance — is provided by a package extension:

julia
pkg> add NLopt

Loading NLopt activates TensNDNLoptExt and enables the methods of proj_tens that take no axis or frame:

julia
using TensND, NLopt

B, d, drel = proj_tens(:TI, A)        # axis optimized
B, d, drel = proj_tens(:ORTHO, A)     # frame optimized

Without NLopt, everything else works, including projection onto a class with a given axis or frame and the optimize_angles = false path of best_sym_tens, which infers the orientation from the Kelvin–Mandel eigenstructure. See Projection.

Symbolic backends

SymPy and Symbolics are ordinary dependencies, so both symbolic element types are available without further installation. SymPy calls into Python through PyCall; if its build fails, the usual remedy is

julia
ENV["PYTHON"] = ""
import Pkg; Pkg.build("PyCall")

which installs a private Conda Python. See Symbolic and numeric for how the four scalar worlds — Float64, ForwardDiff.Dual, Sym and Num — relate.

Checking the installation

julia
using TensND

Spherical = coorsys_spherical()
θ, ϕ, r = getcoords(Spherical)
𝐞ᶿ, 𝐞ᵠ, 𝐞ʳ = unitvec(Spherical)
@set_coorsys Spherical

DIV(𝐞ʳ)          # 2/r
LAPLACE(1 / r)   # 0

If those two return 2/r and 0, the symbolic stack is working.

Citing

bibtex
@misc{TensND.jl,
  author  = {Jean-François Barthélémy},
  title   = {TensND.jl: symbolic and numerical tensor calculations
             in arbitrary coordinate systems},
  url     = {https://github.com/MicroPoroChemoMechanics/TensND.jl},
  doi     = {10.5281/zenodo.17985768},
  year    = {2026}
}

CITATION.cff in the repository root carries the same metadata in a machine-readable form. Works cited by this documentation are collected on the References page.

PackageRole here
Tensors.jllow-level storage for small tensors
OMEinsum.jlthe contraction engine
SymPy.jlsymbolic backend
Symbolics.jlnative Julia CAS backend
Rotations.jlrotation representations
ForwardDiff.jlautomatic differentiation
NLopt.jloptional, orientation search