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

1
vote
2answers
102 views

Update: Calculate Tensor products and traces with Mathematica

My goal is to algebraically simplify expressions involving tensor products and taking the trace. That is, I would like to compute $\operatorname{Tr}\left( \prod_i(id+a_i \otimes b_i) \right)$, using ...
2
votes
0answers
42 views

Identity Matrix in symbolic Tensor Product

I am trying to simplify symbolic tensor products. E.g. ...
4
votes
1answer
32 views

What do I need to know about simplifying expressions involving Symbolic Tensors?

I want to use Mathematica to show that the inner product of a vector with itself is equal to the square of its norm. This is what I tried: ...
0
votes
1answer
70 views

Calculate Dot product of a TensorProduct

Using this answer ...
3
votes
1answer
46 views

Expanding the Riemann tensor (perturbation)

I am trying to expand the following term (via the perturbation expansion $g_{\mu\nu} = \eta_{\mu\nu} + \kappa h_{\mu\nu}$): $$ \frac12 \epsilon^{abcd}R^e_{fcd}R^f_{eab} $$ Where $R$ is the Riemann ...
2
votes
1answer
66 views

Explicit Contraction of Tensor Indices [duplicate]

Is there any easy way to explicitly contract indices of several given tensors. For example, ...
3
votes
1answer
49 views

How to fill a tensor with matrices one by one?

I have this tensor: nn = 4; tableToFill = Table[x, {p, 1, nn}, {q, 1, nn}, {i, 1, nn}, {j, 1, nn}]; that I want to fill with a matrix one by one with a matrix ...
6
votes
1answer
62 views

Matrix Multiplication after “Flatten”

Say we originally had two matrices, $A$ and $B$, both $n \times n$, whose product $$ C= A.B $$ Now I flatten $A$. I can obtain a flatten $C$, from the following multiplication $$ ...
0
votes
1answer
78 views

Nonrectangular tensor encountered [closed]

I am trying to solve a system of equations which characteristic matrix: ...
1
vote
2answers
82 views

Displaying tensors

I want to display the values of a table with superscirpts and subscripts in a list as bellow. ...
6
votes
1answer
78 views

Issue with TensorWedge and TensorReduce?

Bug introduced in 10.0.0 and fixed in 10.3.1 If I use TensorReduce on the result of TensorWedge: ...
1
vote
1answer
86 views

Calculation of tensor structure

I would like to calculate following type of contraction: $$ P_{ij}^{p-k} P_{lm}^{k} ((p_l - k_l) \delta_{ij} + k_j \delta_{il}) (k_n \delta_{im} - p_m\delta_{in}) = ? $$ where p,k are ...
1
vote
0answers
68 views

Ricci tensor with Mathematica [closed]

I'm trying for first time to write a Ricci tensor with Mathematica. The code I've written is this: ...
2
votes
2answers
72 views

Syntax for higher rank tensor multiplication

I am trying to do some matrix multiplication in Mathematica but I just cannot figure out the correct syntax for my problem. I want to write the following: $$ A\pmatrix{a & b\\c & ...
2
votes
0answers
51 views

Simplifying symbolic expressions using TensorExpand

Following my previous question I have this issue using TensorExpand: KroneckerProduct[x, y].(KroneckerProduct[2 z, w]) // TensorExpand results in ...
4
votes
0answers
46 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. ...
8
votes
0answers
131 views

Efficient way to flatten or transpose-arrayreshape tensors

I have a tensor of dimensions $(2, 100, 100, 2, 100, 100)$ and I want to reshape it to a form of $(2*100*100,2*100*100)$, e.g. Flatten[A,{{1,5,6},{4,2,3}}]. If I ...
2
votes
1answer
54 views

Choosing Minkowski metric in Feyncalc

This is related to the Mathematica package FeynCalc. Is there a way to simplify the metric? I mean in the sense that when I evaluate something and I get a long expression involving lots of ...
1
vote
1answer
87 views

Curl of a second-order tensor

In Mathematica 9.0, the documentation for the Curl function states that in n-dimensions "the resulting curl is an array with depth n-k-1 of dimensions". Accordingly, if a 2-dimensional array is feeded ...
2
votes
0answers
55 views

Arrays with two different types of indices

Is there a way of having arrays which have, so to speak, two different depths $m,n$? From the point of view of memory usage, it would be the same as an array of depth $m+n$, but I would like to ...
3
votes
1answer
41 views

Simplifying nested KroneckerProducts

Any suggestion how to bring a nested KroneckerProduct form into just one? I mean some how converting ...
1
vote
2answers
186 views

Compute a double dot product between two tensors of rank 3 and 2

I would need help to calculate a double dot product between a rank 3 tensor A and a rank 2 tensor B (A:B) using mathematica. Does someone know how to do that? Thank you for your help!
1
vote
0answers
55 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. ...
12
votes
1answer
170 views

Nearest Kronecker Product

Some people (see The ubiquitous Kronecker product by Van Loan) have worked on finding two matrices $\mathbf A$,$\mathbf B$ of specified size whose tensor product $\mathbf A\otimes\mathbf B$ is closest ...
6
votes
3answers
232 views

How to simplify symbolic expressions with KroneckerProduct

Having $X,Y$ being symbols for matrices, I was wondering if there is a way to simplify expressions like KroneckerProduct[X, X] + KroneckerProduct[-X, X] to ...
1
vote
1answer
69 views

Issue with Differentiation over a tensor

I am new user in Mathematica. I am working with liquid crystal theory, and one of the notation there is the tensor: $ \Pi_{ij} = \frac {\partial {F_{el}}} { \partial ( \partial {n_i} / \partial { ...
5
votes
2answers
120 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
vote
1answer
61 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. ...
2
votes
1answer
104 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. ...
2
votes
0answers
89 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
117 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
165 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
80 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
59 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
219 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
50 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
154 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
36 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
376 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 ...
8
votes
1answer
235 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
45 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
97 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
216 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
165 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 ...
3
votes
0answers
55 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: ...
7
votes
2answers
691 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
25 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
121 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: ...
2
votes
0answers
90 views

SymmetrizedArray of stiffness/compliance tensor

The stiffness and compliance tensors of a material are 3x3x3x3 tensors relating stress and strain. ...
1
vote
1answer
141 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?