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

481 questions
Filter by
Sorted by
Tagged with
1 vote
41 views

### What is the right way to simplify a tensor expression (with many indices, but no derivatives) in Mathematica?

After not finding the desired capabilities in base Mathematica, I am trying to use xActxTensor package. It appears that I do not need most of it capabilities ...
• 166
48 views

### Simplification of Momentums in FeynCalc

I have a little problem involving the following contraction in FeynCalc: $$\frac{k^{\delta}k^{\sigma}}{k^2}$$ By hand one would lower $\sigma$ and contract with the other momentum to cancel $k^2$, ...
583 views

### How can I "multiply" nested lists?

Given two nested lists alist={{a,b,c},{d,e,f}} blist={{r,s,t},{x,y,z}} How can I get ...
• 717
1 vote
57 views

### How to multiply five tensors of different ranks (contravariant, covariant and mixed) in Mathematica?

How to compute the following multiplication of five different tensors of different ranks in Mathematica ...
82 views

### Symbolic matrix tensor an identity without specifying the dimension?

I want to calculate an expression like $\left( M_1\otimes I+I\otimes M_2 \right) ^l$ with $M_i$'s symbolic matrices and $I$ the identity matrix with Mathematica. $M_i$'s are of the same dimension and ...
• 135
1 vote
67 views

### TensoriaCalc does not display the correct output

I am trying to use TensoriaCalc to calculate the components of the Ricci and the Riemann tensor of the following metric: $R^{2} \left(d\theta^{2} + \sin^{2}\left(\theta \right)d\phi^{2} \right)$; ...
• 111
1 vote
53 views

### Mathematica, ML and TensorFlow

I am currently studying a specialization on Coursera in Machine Learning and am investigating various tools to help me out with the maths and with visualisations and so on. Although I have many ...
• 111
40 views

### How to access row of a 6 dimensional tensor fast?

I have a data set in 2D array form ...
• 403
56 views

### Quickly summing matrix elements

I have a pair of rank-4 tensors, (T,V), where each index takes four values. I want to quickly contract these with the rank-4 antisymmetric tensor using the following operation: ...
• 647
49 views

### Polar to Cartesian coordinate transformations [duplicate]

I'm trying to plot the energy boundary function EBminus[r, \theta, LL, S, BB] using Polar to Cartesian coordinate transformations. The plot should be a closed curve....
• 87
111 views

### Pathological expression for field strength contractions in a curved background

I am trying to define in Mathematica the quantity $\star F^{\mu}=\frac{1}{2}\epsilon^{\mu\alpha\beta}F_{\alpha\beta}$, where $F_{\mu\nu}=\nabla_\mu A_\nu-\nabla_\nu A_\mu+\left[A_\mu,A_\nu\right]$. ...
31 views

### Simulation of Quantum pseudo-telepathy

I would like to mathematically simulate Quantum pseudo-telepathy on The magic square game from Wikipedia. In section Pseudo-telepathic strategies we can read: The trick is for Alice and Bob to share ...
• 5,915
38 views

### Why is TensorContract[x, {}] not always x?

If I use TensorTranspose on an undefined symbol, nothing happens unless the permutation is the identity. For instance, ...
• 228
1 vote
35 views

### Tensor equation problem (xact package)

So i want to solve the tensor equation P1[-μ,-ν]=0 with respect to A[r] and then B[r] but the problem is when hitting shift-enter the tensor given is way too long (if i press "show all" my ...
• 11
107 views

How can one do a fast sparse tensor addition? Below, I have the following code: We first generate 3 random sparse 1000x1000x1000 tensors with 10^6 entries each. Then, I want to add them. But the usual ...
1 vote
88 views

### How to define a traceless tensor with xAct

I would like to define a tensor $A_i^j$ which is traceless ($A_i^i = 0$) and to obtain $A_i^j \delta^i_j = 0$ with xAct / xTensor / xCoba. I first tried defining an antisymmetric tensor, since they ...
• 386
1 vote
411 views

### Code for Tensor decomposition

I would like to know if there is a package or some MMA code to perform tensor decomposition as e.g. defined in a paper by Robeva "Orthogonal decomposition of symmetric tensors" or some ...
69 views

### "Symmetrize" shall symmetrize only tensor values $\ne 0$

Using Symmetrize I want to transform a tensor to be symmetric under all index permutations for all original entries $\ne 0$. However each entry is normalized by the ...
93 views

• 167
76 views

• 23
67 views

### xAct define normalization

I'm trying to get out some equations in the xAct suite. I would like to somehow define that the norm of a vector is a constant. ...
• 438
159 views

### Using Flatten inside NDSolve

I'm using Flatten to contract a rank 4 tensor and a matrix (rank 2 tensor) inside NDSolve and there seems to be error. Here is ...
• 65
29 views

### Using Manipulate to both change tensor elements and select different tensors

I want to display three different tensors after I transform them within the manipulate function I have three tensors that I want to transform, C1, C1h, and C2, then change through with a PopUpMenu to ...
• 27
1 vote
84 views

### How to produce plots determined by tensor element manipulate function

I want to produce plots within the manipulate function, with the functions determined by the values that I use in the manipulate function. I've gotten the tensor elements to work fine in producing the ...
• 27
56 views

### Symbolic re-assignment of products

Suppose I have some symbolic tensors $X,Y$ and I want to assign X.Y into something else without specifying what $Y$ is. For example, I may want $Y$ to serve as ...
• 242
19 views

### How to get simplified output of tensor mode product [duplicate]

The code PolarizationiC1 = MatrixForm[chiprimeC1 . Epin] . Esin; The result If I run the result, then I get the simplified answer of ...
• 27
1 vote
75 views

### How to make an inverse operation to KroneckerProduct[A, IdentityMatrix[m]]` (simplify matrix)?

The operation KroneckerProduct[A, IdentityMatrix[m]] expands the matrix A in the following way (depending on order of ...
• 3,399
90 views

• 111
164 views

### Doing ArrayReshape in Mathematica doesn't give desired results

I have an array like this for example, a = ArrayReshape[Range, {4, 4}] \begin{align} \left( \begin{array}{cccc} 1 & 2 & 3 & 4 \\ 5 & 6 & ...
• 549
43 views

### Output of expressions unable to have operations be performed on the expression

I am currently trying to use the code linked in the catalog of spacetimes pdf to calculate chirstoffel symbols for a metric which follows as n := 4 ...
• 119
189 views

• 243
159 views

### Create a tensor with a well defined symmetry

I want to create a symmetric rank four tensor with this kind of symmetry: {1,2} and {3,4}. How can I implement this using "Array"? ...
• 153
1 vote
130 views

### How to compute the divergence of a four-vector?

I have a quadri-vector which is given by u = {(E^(-φ0[r]))*(1 - ε δφ[t, r]), (E^(-φ0[r])) D[ε ξ[t, r], t], 0, 0} and a quantity n which is given by <...
183 views

### Mathematica: Partial derivative with respect to tensors

Anyone know how to do the partial derivative of a tensor in d dimensions on Mathematica ? I want to implement something which will calculate directly like that :
86 views

### How to sum over a two tensor with a simple constraint of the form $i<j$?

I am trying to write a sum of the form $$\sum_{i<j}f_{ij}$$ where $i,j\in \{1,2,3,4\}.$ I want to write something like Sum[f[[i,j]], {j,1,4},{i,1,j}] but then ...
• 93
176 views

### Manipulating tensorial terms with xAct, ToCanonical is not perfoming well

I am trying to calculate perturbations of some complicated Lagrangians. Using xAct and more specifically VarD to perform the perturbations the expressions become ...
• 41
192 views

### Creating a rank 4 tensor

I am struggling with creating the rank-4 matrix T in Mathematica. The matric is defined as \$T_{i,j,k,l}= n_i n_j n_k n_l-(\delta_{i,j} n_k n_l +\delta_{i,k} n_j n_l+\delta_{i,l} n_k n_j+\delta_{j,l} ...
• 131
1 vote
699 views

### How do I get the Schwarzschild solution from the Einstein Equations?

Consider the Schwartzchild-like metric $$ds^2=-A(r)dt^2+B(r)dr^2+r^2(d\theta^2+\sin^2\theta d\phi^2).$$ The Einstein field equations for this metric reduce to $$R_{\mu\nu}=0,$$ which is also known as ...
• 119
497 views

### How to do Einstein Summation in Mathematica?

I am working with the de Sitter metric which takes the form $$g=\tau^{-2}\left(-\left(\Lambda / 3-\tau^{2}\right)^{-1} d \tau^{2}+\left(\Lambda / 3-\tau^{2}\right) d t^{2}+g_{\mathbb{S}^{2}}\right)$$ ...
• 93
1 vote