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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
62 views

A code to calculate Einstein tensor [duplicate]

I use the following MA code to calculate Einstein’s tensor. I’m asking about the zero component of the Einstein’s tensor, is it correct? Because I think $G_{00}$ should contains the terms in the zero ...
Dr. phy's user avatar
  • 209
0 votes
0 answers
71 views

Lagrangian density and Christoffel symbols [closed]

According to this article (equation 3.2) the Lagrangian density can be calculated by $$ 2 \mathcal{L} = \left\{\begin{array}{c} a \\ b c \end{array}\right\}(g b c \sqrt{-g})_{, a}-\left\{\begin{array}{...
Soliton-104's user avatar
0 votes
0 answers
49 views

Calculating and collecting the terms of the zero component of the Einstein’s tensor

I try to calculate the $G_{00}$ of the Einstein tensor $G_{\mu\nu}= R_{\mu\nu} -\frac{1}{2} g_{\mu\nu} R$ for the metric: $g_{00}=-a^2(\tau)\left( 1+2 \phi^{(n)}\right),$ $g_{0i} = a^2(\tau)\left( \...
Dr. phy's user avatar
  • 209
0 votes
0 answers
60 views

How to calculate Einstein tensor components for this metric?

I try to calculate the Einstein tensor compenents from the eqution: $ G_{\alpha\beta} = \frac{\nabla_\beta (\partial_\alpha \phi)}{\phi} - \frac{1}{2\phi^2} \left[ \frac{\partial_4 \phi \partial_4 g_{\...
Dr. phy's user avatar
  • 209
2 votes
1 answer
78 views

How to create a vector as a tensor object for different euclidean bases?

The components of a tensor are always displayed with respect to one or multiple basis vectors. For a tensor of rank 1, a vector, in 3D-euclidean space, we resort to three orthonormal basis vectors. ...
ango4's user avatar
  • 45
2 votes
0 answers
48 views

Calculating the strength tensor of a vector field

I'm trying to calculate $$T_{ab} = g_{ab}F_{gd}F^{gd} - F_a^g F_{bg},$$ where $$F_{ab} = \partial_a A_b-\partial_b A_a$$ So I define $F_{ab}$ by: ...
Dr. phy's user avatar
  • 209
0 votes
1 answer
82 views

Is there a good package for solving the Einstein field equations given a metric tensor?

I have a very simple metric tensor. I've built a notebook to calculate the EFE solutions based on this metric. Does anyone know of a good package in the Mathematica library that takes a metric tensor ...
The Shepard's user avatar
0 votes
0 answers
74 views

Metric pertubation in xAct

I start to learn xAct. Following this thread: expanding-the-riemann-tensor-perturbation I noticed that xAct set a default perturbation to the metric by: ...
Dr. phy's user avatar
  • 209
1 vote
1 answer
94 views

Which Slots Are Which? Tensors

I'm trying to verify a calculation in Mathematica and I'm confused about how Mathematica arranges tensor "slots" for contractions. I have the matrix $$J_1 = \begin{pmatrix} 0 & -ih & ...
mijucik's user avatar
  • 147
0 votes
0 answers
131 views

Simplifying the Einstein tensor in case of a perturbed FRW metric

I use the code in this thread's answer: (Calculating Einstein tensor components in Kaluza-Klein model) to get the Einstein tensor components of a four-dimensional Kaluza Klein model. But instead of ...
Dr. phy's user avatar
  • 209
0 votes
0 answers
33 views

Cannot symmetrize products involving tensors with specified symmetry?

I am trying to check some manipulations with tensors with Mathematica (13.3 on Windows), but was stuck on an error from TensorTranspose. I isolated my problem to the following simple case: ...
Sooner's user avatar
  • 387
0 votes
1 answer
91 views

How would you find the metric tensor for this formula?

I have a metric formula that does some interesting things for me. It's excellent at predicting the luminosity of Sne 1a. I'd like to see what the EFE solutions are, but I need to convert it from ...
The Shepard's user avatar
1 vote
1 answer
130 views

Calculating Einstein tensor components in Kaluza-Klein model

I try to calculate the Einstein tensor of Kaluza-Klein model from this paper. It is given by Equation (55) $ G_{\alpha\beta} = \frac{\nabla_\beta (\partial_\alpha \phi)}{\phi} - \frac{1}{2\phi^2} \...
Dr. phy's user avatar
  • 209
4 votes
1 answer
297 views

What are some Mathematica packages used for general relativity?

Could you suggest any Mathematica packages that are used for General relativity calculations? Id like to write code to solve the Schwarzchild Lagrangian equation.
Rishabh sharma's user avatar
0 votes
0 answers
32 views

Tensor Algebra of Symmetric Algebra with Symoblic Tensors

Given $V=\mathbb{R}^3,$ I would like to work symbolically with elements of $\mathrm{T}^{(k_1,\dotsc,k_n)}(\mathrm{S} V),$ i.e. vectors of the form $$\phi = \phi_1 \otimes \cdots \otimes \phi_n$$ with $...
Marvin Dippell's user avatar
2 votes
2 answers
148 views

Lorentz indices contraction

I have a complex expression involving second-rank tensors and Kronecker Deltas. How can I instruct Mathematica to utilize the Kronecker Deltas and perform proper index replacements? For example, ...
Hawi's user avatar
  • 173
1 vote
1 answer
88 views

Multiplying abstract tensors in Mathematica

I want to do an operation like $$ AA \otimes BB \times AA' \otimes BB' $$ and have $$AA \times AA' \otimes BB \times BB' $$ without specifying the elements of $AA$s and $BB$s (and so are their primes)....
Tom's user avatar
  • 121
0 votes
0 answers
47 views

Variation of Lagrangian with respect to components of inverse of metric tensor

I am super new to Mathematica, so I apologize if the question is trivial. I have defined metric tensor (4x4 matrix), inverse metric and Lagrangian: ...
DanielP's user avatar
0 votes
0 answers
28 views

Symmetric expression not recognized

Why the following symmetric tensor is not recognized by TensorSymmetry? ...
enzotib's user avatar
  • 1,054
1 vote
0 answers
48 views

Operations on symbolic tensors

I have recently discovered the set of functions related to symbolic tensors, namely TensorProduct, TensorContract, ...
enzotib's user avatar
  • 1,054
1 vote
3 answers
104 views

Product involving Kronecker Deltas

I am trying to do some products involving some objects made out of Kronecker deltas. For example, taking an object like $x_{abcd}=\delta_{ab}\delta_{cd}$, where all the indices run from $1$ to $N$, I ...
dorrel's user avatar
  • 15
2 votes
0 answers
97 views

How to define a Kerr-Schild metric in xAct?

A Kerr-Schild can be expressed as $g_{ab}=\eta_{ab}+\phi k_a k_b$, where $\eta_{ab}$ is Minkowski metric, $\phi$ is a scalar function and $k_a$ is a (co)vector field which is null and geodetic with ...
Dongba's user avatar
  • 21
1 vote
0 answers
68 views

Finding Petrov type of a metric

Is there a subpackage in xAct (or another Mathematica package for general relativity calculations) to determine the Petrov type of a metric? I understand that xAct has a lot of subpackages for ...
stupidstudent's user avatar
0 votes
0 answers
83 views

How to write the metric tensor in n-dimensions using xAct?

I am trying to reproduce some calculations from a paper, where they express the angular part of the metric as a solid angle in (d-2) dimensions: where I know how to calculate the metric tensor using ...
Matheus Macêdo's user avatar
2 votes
1 answer
169 views

Efficient way to MapApply for Tensor

I need to Map a function with certain arguments $f(\alpha,\beta,\gamma,\delta)$ onto a whole tensor. My current approach looks like ...
mathetronaut's user avatar
5 votes
3 answers
115 views

Implementing symmetry assumptions in FullSimplify

I want to symmetrise a long expression, M, that involves a function of 4 arguments, f[u1,u2,d1,d2], and its products (for ...
jms547's user avatar
  • 389
1 vote
1 answer
69 views

Calculating the orthonormal frame of a metric in Mathematica

Let us have a given a general metric (like say Kerr metric) of which I want to find the orthonormal coordinates by developing a general code in Mathematica. One of the reliable method to do this (by ...
SCh's user avatar
  • 175
1 vote
1 answer
70 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 xAct`xTensor package. It appears that I do not need most of it capabilities ...
fiktor's user avatar
  • 166
0 votes
0 answers
91 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$, ...
bocchi's user avatar
  • 1
8 votes
4 answers
607 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 ...
1729taxi's user avatar
  • 747
1 vote
0 answers
63 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 ...
Sangeeta Dey's user avatar
2 votes
2 answers
107 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 ...
narip's user avatar
  • 261
1 vote
1 answer
107 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)$; ...
RKerr's user avatar
  • 113
1 vote
0 answers
93 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 ...
serlingpa's user avatar
  • 111
0 votes
0 answers
45 views

How to access row of a 6 dimensional tensor fast?

I have a data set in 2D array form ...
csk 7's user avatar
  • 403
4 votes
1 answer
59 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: ...
miggle's user avatar
  • 647
0 votes
0 answers
51 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....
MMS's user avatar
  • 87
2 votes
1 answer
120 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]$. ...
Sonia Llambias's user avatar
2 votes
0 answers
35 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 ...
azerbajdzan's user avatar
  • 9,653
3 votes
0 answers
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, ...
srossd's user avatar
  • 228
1 vote
0 answers
68 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 ...
Stelios's user avatar
  • 11
7 votes
1 answer
124 views

Fast Sparse Tensor Addition

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 ...
Florentin Münch's user avatar
1 vote
1 answer
190 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 ...
gypsophila's user avatar
2 votes
2 answers
502 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 ...
granular bastard's user avatar
3 votes
2 answers
76 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 ...
granular bastard's user avatar
0 votes
1 answer
181 views

Is there a way of calculating Expectation Values of tensor operators in Mathematica?

This Wikipedia article in on Bell's Theorem lists a whole bunch of expectation values for Bell states: $$\langle A_0 \otimes B_0 \rangle = \frac{1}{\sqrt{2}}, \langle A_0 \otimes B_1 \rangle = \frac{1}...
yippy_yay's user avatar
  • 243
4 votes
2 answers
468 views

Torch-like permutation for arrays?

Update: edited to clarify my confusion. In Mathematica Transpose[] operates like this: ...
KRao's user avatar
  • 73
4 votes
2 answers
158 views

Symmetric product

Let define the full symmetrization of a tensor $e_1 \otimes ... \otimes e_N$ by $$ Sym : e_1 \otimes ... \otimes e_N \rightarrow \frac{1}{N!} \sum_{\pi \in S_N} e_{\pi^{-1} (1)} \otimes ... \otimes e_{...
Baloo's user avatar
  • 167
2 votes
1 answer
78 views

Certain block matrix

A block matrix like $$m_{(ij),(kl)}=\delta_{ik}\delta_{jl}$$ can be constructed as L=3; id=IdentityMatrix[L]; m=KroneckerProduct[id, id]; But how to construct $$m_{...
yarchik's user avatar
  • 17.7k
1 vote
0 answers
92 views

Error message installing Ricci

I just started using Mathematica. With the goal of solving a Loop integrals over a scalar gravity interaction. For the tensor calculus necessary i wanted to use, Ricci. https://sites.math.washington....
Faktor 2's user avatar

1
2 3 4 5
11