## TensND.jl

Package allowing tensor calculations in arbitrary coordinate systems.
Author jfbarthelemy
Popularity
3 Stars
Updated Last
1 Year Ago
Started In
August 2021

# TensND

Package allowing tensor calculations in arbitrary coordinate systems.

Documentation Build Status

## Introduction

This Julia package provides tools to perform tensor calculations of any order and any dimension in arbitrary coordinate systems (cartesian, polar, cylindrical, spherical, spheroidal or any user defined coordinate systems...). In particular differential operators are available: gradient, symmetrized gradient, divergence, Laplace, Hessian. The implementation of this library is much inspired by the Maple library Tens3d developed by Jean Garrigues.

This package and its manual are still under construction. The API may vary before official release.

The following example is provided to illustrate the purpose of the library

julia> using SymPy, TensND

julia> Spherical = coorsys_spherical() ; θ, ϕ, r = getcoords(Spherical) ; 𝐞ᶿ, 𝐞ᵠ, 𝐞ʳ = unitvec(Spherical) ;

julia> @set_coorsys Spherical

(1/r)𝐞ᶿ⊗𝐞ᶿ + (1/r)𝐞ᵠ⊗𝐞ᵠ

julia> DIV(𝐞ʳ ⊗ 𝐞ʳ) |> intrinsic
(2/r)𝐞ʳ

julia> LAPLACE(1/r) |> intrinsic
0

julia> f = SymFunction("f", real = true)
f

julia> DIV(f(r) * 𝐞ʳ ⊗ 𝐞ʳ) |> intrinsic
(Derivative(f(r), r) + 2*f(r)/r)𝐞ʳ

julia> LAPLACE(f(r)) |> intrinsic
d
2         2──(f(r))
d            dr
───(f(r)) + ──────────
2             r
dr

julia> for σⁱʲ  ("σʳʳ", "σᶿᶿ", "σᵠᵠ") @eval \$(Symbol(σⁱʲ)) = SymFunction(\$σⁱʲ, real = true)(\$r) end

julia> 𝛔 = σʳʳ * 𝐞ʳ ⊗ 𝐞ʳ + σᶿᶿ * 𝐞ᶿ ⊗ 𝐞ᶿ + σᵠᵠ * 𝐞ᵠ ⊗ 𝐞ᵠ ; intrinsic(𝛔)
(σᶿᶿ(r))𝐞ᶿ⊗𝐞ᶿ + (σᵠᵠ(r))𝐞ᵠ⊗𝐞ᵠ + (σʳʳ(r))𝐞ʳ⊗𝐞ʳ

julia> div𝛔 = simplify(DIV(𝛔)) ; intrinsic(div𝛔)
((-σᵠᵠ(r) + σᶿᶿ(r))/(r*tan(θ)))𝐞ᶿ + ((r*Derivative(σʳʳ(r), r) + 2*σʳʳ(r) - σᵠᵠ(r) - σᶿᶿ(r))/r)𝐞ʳ

## Installation

The package can be installed with the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run:

Or, equivalently, via the Pkg API:

## Documentation

• DEVdevelopment version of the documentation.

## 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}
}

## References

### Required Packages

View all packages

### Used By Packages

No packages found.