# Questions tagged [tensors]

Use this tag for questions that involve tensors. Tensors are fundamental tools for linear computations, generalizing vectors and matrices to higher ranks. Mathematica 9 introduces powerful methods to algebraically manipulate tensors with any rank and symmetry.

97 questions
Filter by
Sorted by
Tagged with
5k views

### InternalBag inside Compile

Since InternalBag, InternalStuffBag and InternalBagPart can be compiled down, it is a ...
• 113k
44k views

### How to calculate scalar curvature, Ricci tensor and Christoffel symbols in Mathematica?

I am seeking a convenient and effective way to calculate such geometric quantities. I've used packages like TensoriaCalc, but they don't work at all time. Sometimes,...
• 665
6k views

### Contracting with Levi-Civita (totally antisymmetric) tensor

I have an array $v_{ijk}$ which is effectively a rank-$3$ tensor with dimensions $3\times3\times3$, and I need to contract it with $e^{ijk}$, i.e. evaluate $v_{ijk} e^{ijk}$ (see Einstein convention)....
• 71
5k views

### Ways to compute inner products of tensors

One way to evaluate the following sums is combining Table and Sum: $u_{abcd} = \sum_{e=1}^3 v_{aeb}w_{ced}$ $q_{ab} = \sum_{d,e=1}^3 v_{d e a}w_{deb}$ It will look like ...
• 7,757
3k views

### Elementwise join

I have two tensors of arbitrary but equal rank n (and equal dimensions): A and B, and I want to get a third tensor of rank n + 1,...
• 1,581
1k views

• 6,418
917 views

• 909
410 views

### Function to convert TensorContract[_TensorProduct, indices] into equivalent Dot + Tr version

Mathematica can use either Dot + Tr to represent some tensors, or TensorContract + ...
• 131k
6k views

### Perturbation theory in general relativity using xAct

I'm trying to use the xAct Mathematica package for manipulating tensors, and I'd like to plug in a metric into the perturbation equations to first order in general relativity, and have everything ...
• 325
557 views

### How to force Series[] to compute expansions by considering non commutative multiplication?

I wish to compute the Taylor series expansion of the following iteration method $x_{k+1}=x_k-f'(x_k)^{-1}f(x_k)$ up to four terms of error ($e_k=x_k-\alpha$). When this is a scalar iteration, I very ...
• 491
1k views

### Perform matrix/tensor contractions more efficiently

Problem: explicit index contractions for matrices using the Sum command take too long, and I want to improve the performance for complicated computations. Let me ...
• 951
144 views

### Implementing the symbolic identity matrix $I$

I am working with symbolic tensors within Mathematica and I wanted to ask if there is a way to have a symbolic identity tensor.
514 views

### Can I use symbolic tensors for simple linear algebra and calculus?

As an example, I'd like to calculate this symbolic derivative: $\frac{\partial}{\partial b}(x-A.b)^{\mathsf{T}}.(x-A.b)$ where $x$ and $b$ are vectors and $A$ is a matrix. What I tried is this: <...
• 36.1k
541 views

### How is Grad defined for array particularly in non-Cartesian coordinates?

This question can be viewed as a follow-up of What is the definition of Curl in Mathematica? First argument of Grad can be an array, but what definition does ...
• 66.2k
830 views

### Solving antisymmetric tensorial equation

Assume we have the following Tensor objects: $$F_{i}{}^{j}\;and\;S_{ij}{}^{k},$$ where the components of $F$ are known, and we would like to solve for the components of $S$ ...
• 135
654 views

### Looking for a package for Cartan formalism in Mathematica

I want to convert a gravity action in terms of differential forms to tensorial expressions. A procedure known as tetrad formalism/Cartan formalism like Palatini action in this page: CARTAN FORMALISM ...
483 views

### Conveniently solving tensor equations in which the contained tensors have various symmetries

How do I conveniently solve tensor equations in which the contained tensors have various symmetries?
• 216
2k views

### Linearized Einstein Equations with Mathematica

I need to compute the linearised Einstein Equations around a fixed metric $g_{\mu \nu}$ which is not the flat metric. Someone knows any Mathematica package or a review that can help me?
• 151
649 views

### Efficient implementation of tensorial Rayleigh product

I am interested in the tensor product $\hat{B} = A \star B$ (which at least I know as Rayleigh product), defined with components \hat{B}_{i_1 i_2 ... i_ n} = \sum_{j_1 = 1}^d \sum_{...
• 5,473
396 views

### Expanding tensors

This is a follow-up on / clarification of this thread. I have the following in a notebook: ...
• 163
1k views

• 287
4k views

### Higher order SVD

Does anyone know how to do a higher order SVD in Mathematica ? A good reference seems to be here http://www.sandia.gov/~tgkolda/pubs/pubfiles/SAND2007-6702.pdf but I don't understand their formalism ...
• 11k
2k views

### Computations in the exterior algebra

I want to be able to compute with explicit exterior algebras of vector spaces. For example, given a real vector space $V$ of $3 \times 3$ matrices, I want to consider expressions of the form \$v\wedge ...
1k views

### A comprehensive list of all correct input formats for [[experimental]] Neural Net functions?

Question: correct formats for Mathematica's NetTrain function Explanation of the problem Background So Mathematica 11 was released earlier this month, and while there are many improvements and they ...
• 5,422
504 views

### How can I automate this tensor computation?

I am doing this work by hand, but it takes a lot of time and I make several calculation errors, so I was thinking to make Mathematica to calculate this for me, but I am stuck at the very beginning. I ...
• 6,727
646 views

### Reduce the output from tuples by including symmetry?

I need all the possible 3x3 binary tensors, but I'd like to have this account for symmetries. I've started by using the Tuples command. Tuples[{1, 0}, {3, 3}] ...
• 683