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

64 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
411 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: <...
128 views

### Performance improvements by using Activate and Inactivate

In a question about improving performance of a TensorContract of a TensorProduct, user jose suggested replacing ...
298 views

### Variating the derivative of the metric using xTensor

I would like Mathematica to be able to use the following expression in a more complicated computation: \begin{equation} \tag{1}\frac{\delta{}g^{\alpha\beta}_{\;{},\gamma}\left(x\right)}{\delta{}g^{\mu\...
76 views

### TensorContract applied twice

I have a very simple question about TensorContract command: I'm declaring ...
40 views

### Pair-wise antisymmetric tensor

I am trying to define a tensor $T$ which is antisymmetric under pair-wise exchange of its indices: $T = \delta_{a],[b}\,\delta_{c],[d}\,\delta_{e],[f}\,\delta_{g],[h}$ where $T$ is antisymmetric under ...
50 views

### speed up tensor expand

I am using the following code ...
285 views

### How to write Coordinate Chart in Xcoba in index form?

I am using xCoba for manipulating tensors. I do the usual, defining my metric, manifold, chart etc. ...
745 views

### Tensor product involving Levi Civita symbol

I'm working with xAct package. I've defined the tensor component values and my issue is that I want an expression involving Levi Civita symbols and tensor components, I don't know how to deal with it. ...
166 views

### Spin Connection using Mathematica

Hello I want to use Mathematica in order to calculate the spin connection of a metric, specifically of the metric \begin{equation} \left(\begin{array}{cccc} -1 & 0 & 0 & 0 \\ 0 & \...
67 views

### Lie-algebra valued non-abelian differential forms in Mathematica

I am trying to implement wedge product of Lie-algebra valued differential forms in the non-abelian case. Concretely, I am intereste in 1- and 2-forms, that is, $A$ and $F$. Is there a way of doing ...
139 views

### Lowering the index of the Riemann curvature tensor in Mathematica

I am looking to do some calculations in GR. For a given metric, I can calculate the affine connection and the Riemann tensor as, ...
127 views

### How to define a constraint implying covariant derivatives in XTensor/XAct?

I have two manifolds: M and M1 with metrics g and g1. ...
126 views

### Determinant of 2-forms

I have matrix 4x4 and elements of the matrix are 2-forms. How to calculate determinant (in Mathematica 11) if this matrix using external product instead of normal product? I use components of Riemann ...
155 views

### How can I perform tensor contractions without first storing an unnecessarily large tensor?

I'm performing a calculation which requires me to start with a collection of tensors and contract out their indices according to a pattern that I've written down. Right now, if I have a pair of two ...
144 views

### How does HodgeDual work?

The Hodge dual of a $p$-form is explicitly metric dependent, but the function HodgeDual[] doesn't seem to ask for the metric as an argument. How does that work? ...
79 views

### Nested TensorContract bug

Bug introduced in version 9.0.0 or 9.0.1 and fixed in 10.1 or 10.2 When nesting TensorContract the result I get is wrong. Input: ...
807 views

### how to associate a metric for tensor contraction operations?

I see that Version 9 now has some built in tensor support (which was missing back when previously asked How to represent and manipulate abstract indexed vector (or tensor) expressions?). The docs ...
29 views

### How to define tensors similar to Riemann tensor in xAct xTensor xTras

I'm working on a project where we deal with objects very similar to Riemann tensor. In fact they are Christoffel symbols for higher spins. I'm using xTras for modeling problems in wolfram mathematica. ...
26 views

### Optimising tensor operations under memory constraints

Let riem is a free variable with riem ∈ Arrays[{4, 4, 4, 4} as assumption. Let: ...
50 views

### Parallelize and tensor calculus

Is it possible to use Parallelize with tensor calculus functions like TensorContract and ...
86 views

### How to remove the Riemann tensor derivatives using Bianchi identity?

For the third-order Lovelock gravity, after varying the Lagrangian versus the metric, I found some derivatives of the Riemann tensor which should not be appeared. How can I remove them? Maybe using ...
169 views

### Exterior products of differential forms

In $\mathbb{R}^4$ I have the forms $\omega_1=z\;\mathrm dx+t\;\mathrm dy+x\;\mathrm dz+y\;\mathrm dt$ and $\omega_2=t\;\mathrm dx+z\;\mathrm dy+y\;\mathrm dz+x\;\mathrm dt$. I want to compute ...
378 views

### Solving Relaxed Einstein Equation with xAct and xTensor packages

First time question, involving tensor calculus. I am entirely new to Mathematica and don't understand most of its conventions or jargon. I'm trying to do tensor calculations in GR. I've ...
111 views

164 views

### Smooth Max and Abs

I'm trying to implement smooth approximations of Max and Abs functions. Moreover I want the functions to map element-wise on tensors. Here's my code. ...
50 views

27 views

### keep variables in the correct position when TensorExpand

I would like to expand a tensor expression of 3-d vectors. However, the code runs really slow, the problem is asked here: Why is TensorExpand so slow for vector operations? However, I found that by ...
43 views

### How to define a symbollic matrix with variables and numbers

Newbie here. I want to define a (user-defined)function to return symmetric matrices, as I need to define quite a few tensors. I am able to do this using strings. But I need the matrix entries to be ...
477 views

### Obtaining Explicit Expressions for Tensor Contractions in xCoba

I Would like to know, how to reduce a general Tensor expression such as Cd[-c][Cd[c][h[-a,-b]]] (D'alambertian of some unknown two component tensor) to an explicit ...
111 views

### Noncommutative tensor product

I am using Mathematica 8. Is there any way to make a noncommutative tensor product calculation? For instance, I have the following relations : $XY=YX; \ Xt=qtX; \ Yt=qtY$. Is there any way to make a ...
112 views

### Finding tensor of a matrix equation

I am trying to find the tensor, M for the following equation $\rho' = M\cdot\rho$ where $\rho$ is a $n \times n$ matrix. How do I find the tensor $M$? I tried changing $\rho$ into a column vector ...
82 views

### Continuous integration of a tensor function using discrete density values

Hei, I am wondering is it possible to implement continuous integration using Integrate() of a fourth order tensor with discrete density values. ...
49 views

25 views

### Shorten a sum of many terms by introducing a rule for scalar product and Kronecker deltas and using repeated replacements

There is a sum of many terms that I would like to simplify by introducing a notation for scalar product of two vectors. Each term is a product of constants and of several components of 3D vectors: <...
I want to write the tensor product A $\otimes$ B in matrix form, where\begin{equation} A= \left[ {\begin{array}{cc} 1 & 2 & 3\\ 4 & 5 &6 \\ 7 & 8 &9 \\ \end{array} } \...