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.

learn more… | top users | synonyms

3
votes
1answer
62 views

The fastest way of raising indices of high rank tensor

I have some high dimensional high rank tensors, let's say $$F_{ijkl}$$ and I need to find $$F^{abcd}=g^{ai}g^{bj}g^{ck}g^{dl}F_{ijkl}.$$ Here $g^{ij}$ is the contravariant metric. Simple summation ...
-1
votes
0answers
46 views

Mixing tensorial calculation

I would like to know if there is solution of this problem: Let \begin{align*} a & := \left(1,x(t),\int_0^t\int_0^{s_1}dx(s_2)\cdot dx(s_1)\right)\\ b &:= ...
0
votes
1answer
40 views

Is there a package that can calculate the Ricci tensor from a numerically given metric?

There are many packages about general relativity or differential geometry, and they can calculate the Ricci tensor from a symbolically given metric, for example, $g_{tt}=-f(r)$, $g_{rr}=h(r)$, etc. ...
1
vote
1answer
52 views

How to swap tensor indices without permutation?

Say I have a tensor of rank R, How to swap $i^{th}$ and $j^{th}$ tensor index? I do not want to use TensorTranspose because it requires to write down the entire permutation, i.e. ...
1
vote
0answers
54 views

Fast construction and reshaping of large tensors

I'm trying to construct a large matrix which is derived from some higher rank tensor (the rank of interest to me changes case by case, so it needs to be a general method). Currently, the process of ...
4
votes
2answers
67 views

Using LeviCivitaTensor

I have 2 questions about using LeviCivitaTensor, based on the following session: The signs for the cross product seems to come out "opposite" of what I expected. Why is that? Did I miss anything? ...
2
votes
1answer
67 views

Tensors with mixed symmetry

I want to work with tensors of mixed symmetry, for example with a rank 3 tensor $A_{ijk}$ that is symmetric under the exchange of $i$ and $j$ and antisymmetric with respect to $i$ and $k$. I was ...
2
votes
1answer
74 views

Abstract iterator in Do

I'm trying to write a module. Its input is a matrix (tensor), the module should return new tensor with increased rank with 1. The new tensor is defined as $$ O \Rightarrow N_{\alpha \beta \ldots ...
0
votes
0answers
56 views

Atlas 2 For Mathematica. Need to calculate Riemann tensor, etc [duplicate]

Is anyone familiar with Atlas 2 for Mathematica to calculate the Riemann Tensor, Ricci Tensor, and scalar I have a metric that I need to calculate these things for. Can anyone help? I'm not too up on ...
5
votes
1answer
160 views

FindFit returns “tensors have incompatible shapes”

I'm trying to fit experimental data with FindFit and implicitly calculated function. It seems, that function works fine and satisfactorily approximates data when parameters are fed manually. However ...
2
votes
0answers
42 views

Finding basis of isotropic tensors of rank r

I am looking for a way to obtain a basis of isotropic tensors of rank $r$. Actually I am mostly interested in rank $8$ isotropic tensors but maybe you know already a simple algorithm in order to ...
2
votes
1answer
82 views

Efficient tensor product followed by contraction [duplicate]

Say I want to efficiently evaluate $\sum_{kl}A_{ikjl}B_{kl}$ where $A$, $B$ are numerical tensors. This has been discussed before but with no focus on efficiency. A straightforward way as mentioned ...
1
vote
1answer
29 views

Inverse KroneckerProduct given other arguments

I'm having problems working out how to do the inverse of a two argument Kronecker Product, given one of the decomposed column vectors. For example, say I have used the Kronecker Product on two ...
11
votes
1answer
227 views

How can I define or use a new coordinate system in Mathematica?

I want to use the dipole coordinate system as defined in this paper: http://arxiv.org/abs/physics/0606044 I see that Mathematica can do all kinds of vector analysis using different kinds of ...
7
votes
1answer
157 views

How to define an orthogonal basis in the right way?

I am trying to work with the vector notation without defining vector components explicitly. $Assumptions = (x | y | z) \[Element] Vectors[3] The vectors ...
0
votes
0answers
42 views

Tensor sum contraction [duplicate]

Table[Sum[ KroneckerDelta[[i, j]] LeviCivitaTensor[3][[i, j, k]], {i, 1, 3}, {j, 1, 3}], {k, 1}] Why this doesn't work? how i do to make that sum?
4
votes
1answer
78 views

TensorReduce not simplifying transpose for symmetric matrix?

I know Mathematica is not very good with symbolic manipulation of matrix expressions, but I was surprised to find that it can't reduce the following expression: ...
0
votes
0answers
116 views

Writing rules for Einstein summation

I'm trying to write a list of rules for tensor manipulations and in particular, Einstein summation convention. What I've tried, so far is to write something that would take a generic functions with ...
0
votes
0answers
101 views

Symbolic Tensor Algebra

I need to perform basic tensor algebra in order to double check some very complicated simplification. It's nothing fancy, it just has so many factors by the end that it's hard to tell if an error has ...
0
votes
0answers
103 views

Solving for a coordinate transformation for a rank 2 tensor

I am working on a project in general relativity, and I have a metric or rank 2 tensor $g_{ab}$ of the form, $$g =\left( \begin{array}{ccccc} f(x^a) & 0 & 0 & 0 & 0\\ 0 & -f(x^a) ...
0
votes
0answers
70 views

How to implement a tensor system using indices and Einstein notation?

There are several function like TensorProduct and TensorContract doing basic tensor operations by regarding tensors as lists ...
2
votes
0answers
36 views

Nested `TensorContract` bug

When nesting TensorContract the result I get is wrong. Input: TensorContract[TensorContract[A, {{1, 3}, {2, 4}}], {{1, 2}}] ...
4
votes
1answer
375 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 ...
1
vote
0answers
24 views

Assign a symbolic tensor with determinant greater than zero in Mathematica

I can create a symbolic tensor in Mathematica: $Assumptions = F \[Element] Arrays[{3, 3}, Reals] Is there anyway that I can tell Mathematica, that the ...
1
vote
0answers
81 views

Derivative with respect to a tensor

I am trying to differentiate a tensor with respect to another one in Mathematica, but I can't do it. Down below is the code I am using: ...
0
votes
0answers
42 views

Permute indices of a large sparse array

I'm starting with a very large rank 3 tensor, F, that is stored as a SparseArray, and I need to permute its indices. I first tried using ArrayRules to get the positions of the non-zero elements, to ...
2
votes
0answers
65 views

SymmetrizedArray of stiffness/compliance tensor

The stiffness and compliance tensors of a material are 3x3x3x3 tensors relating stress and strain. ...
1
vote
1answer
95 views

How to take derivative of a tensor leading to kronecker delta? [duplicate]

I'm trying to write a Mathematica program to find derivatives such as the following simple example: Could you please help?
1
vote
2answers
94 views

Change of basis for a rank 3 Cartesian tensor

I have a Cartesian tensor $\chi_{ijk}$ and I want to express the elements in terms of a new basis to get $\chi_{ijk}^\prime$. The transformation is represented using $a_{ij}$. The tensor transforms ...
5
votes
1answer
93 views

Error messages from TensorContract and TensorReduce

I am struggling with a few errors when using symbolic tensors. I am using mathematica 9.0.1.0, linux x86. The following code generates what seems to me an incorrect tensor, this is the smallest ...
1
vote
1answer
151 views

Solving a System/Matrix of Equations in Matrix Form

Ok, I am trying to solve an equation involving matrices (well, tensors actually), which is of the form: $\mathbf{e}^{T} \cdot \mathbf{M} \cdot \mathbf{e}$ = $\mathbf{N}$, where $\mathbf{e}$ is an ...
4
votes
1answer
202 views

How to put the tensor product of two operators onto two variables?

I am trying to make an intuitive Mathemtaica program to show the principle of quantum walking. The idea of quantum walking is very simple and direct, but when I try to transfer it into Mathemitca ...
2
votes
3answers
464 views

Sum with Levi-Civita [duplicate]

I'm trying to write the expression $$\sum_{\alpha,\beta = 1}^{4}\epsilon_{\mu \nu\alpha\beta}a^{\nu} b^{\alpha} c^{\beta}$$ in Mathematica, where $\epsilon$ is the Levi-Civita symbol and $a$, $b$, $c$ ...
4
votes
1answer
249 views

Mathematica package for supergravity and superstring theory

I am looking for a Mathematica package that can manipulate tensors for supergravity, string theory or M-theory. I am particularly looking for a package that can do spinor and Clifford algebra ...
7
votes
0answers
115 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: ...
0
votes
0answers
50 views

Tensor product involving Levi Civita symbol [duplicate]

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. ...
0
votes
0answers
50 views

Get rid of external library dependency

I am trying to generate C code for some functions, which I do not post in full because they are a few hundred lines long. The functions do nothing too fancy: a bunch of dot products, powers and roots. ...
6
votes
2answers
236 views

How to get rid of nested matrices

If I type into Mathematica TensorProduct[IdentityMatrix[2],IdentityMatrix[2]] It gives me a result that has nested matrices. How do I turn that into a normal ...
3
votes
3answers
129 views

How to select elements in a tensor conditional upon their indices

I have a tensor, u, of rank one, meaning that I have a matrix whose elements are themselves matrices. I would like to select, and make a list of, only those sub-matrices whose indices comply with the ...
1
vote
2answers
124 views

Defining tensor components generally

I would like to define a tensor according to its components, something like the following: [F(x)]_i,j = Integrate[f(x,y)A_i(y)B_j(y),y] where i and j are ...
1
vote
1answer
119 views

Matrix/tensor addition behaving funny under replacement?

I have two matrices I want to add, and one of the matrices is a tensor product of two vectors. I've used a SetDelayed to define the summed matrix, because I want to evaluate it for different values of ...
0
votes
0answers
197 views

Symbolic tensor product calculation

I am trying to calculate the symbolic tensor product $\langle \nabla f\otimes f,\nabla g\otimes g\rangle ^2+(\langle \nabla f\otimes g,\nabla f\otimes g\rangle +\langle \nabla g\otimes f,\nabla ...
4
votes
1answer
178 views

On elegant use of Inner and Outer on tensors

I have a collection of 5-element vectors each of which corresponds to an {x,y} location from a (20 x 21) grid. Because of that I represent that data as a (5 x 20 x 21)-sized tensor called ...
1
vote
1answer
119 views

Mathematica does not respect tensor order?

I'm trying to verify an identity involving symmetric traceless tensors over the reals. What I tried was: ...
3
votes
1answer
325 views

Covariant derivative for symbolic tensors

I want to define a "prefix" (D_i) covariant derivative operator CD[] for symbolic tensors in form of a function, i.e. for ...
2
votes
2answers
776 views

Using the epsilon tensor in Mathematica

I'm having a great deal of trouble getting started on a weekly homework assignment in Mathematica. The assignment requires we use the epsilon tensor which is apparently built into Mathematica as ...
2
votes
1answer
1k 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 ...
1
vote
0answers
36 views

How do I define a tensor from another tensor with summations? [duplicate]

Let's say we have a rank 2 tensor $g_{ij}$. This is basically a list with a Depth of 2. Now I'd like to calculate another tensor ...
10
votes
2answers
399 views

How to take derivative of parameterized coordinate?

Suppose I have a vector in $\mathbb{R}^n$ but $n$ is not known in advance. I want to be able to write functions which operate on the components of that vector, and then I'd like to be able to take ...
1
vote
1answer
97 views

Why TensorReduce not working here?

I would like to use TensorReduce to work on the tensor contraction $y_{ib}y_{ia}$ (where index $i$ is summed). However, ...