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
13
votes
0answers
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: <...
9
votes
0answers
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 ...
6
votes
0answers
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\...
5
votes
0answers
76 views

TensorContract applied twice

I have a very simple question about TensorContract command: I'm declaring ...
4
votes
0answers
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 ...
4
votes
0answers
50 views

speed up tensor expand

I am using the following code ...
4
votes
0answers
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. ...
4
votes
0answers
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. ...
3
votes
0answers
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 & \...
3
votes
0answers
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 ...
3
votes
0answers
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, ...
3
votes
0answers
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. ...
3
votes
0answers
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 ...
3
votes
0answers
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 ...
3
votes
0answers
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? ...
3
votes
0answers
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: ...
3
votes
0answers
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 ...
2
votes
0answers
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. ...
2
votes
0answers
26 views

Optimising tensor operations under memory constraints

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

Parallelize and tensor calculus

Is it possible to use Parallelize with tensor calculus functions like TensorContract and ...
2
votes
0answers
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 ...
2
votes
0answers
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 ...
2
votes
0answers
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 ...
2
votes
0answers
111 views

complex tensor expression with Pauli matrices

I attempt to understand is it possible whether to calculate the next expression by means of mathematica: $\varepsilon^{\mu\nu\rho\sigma}tr(\{\partial_{\mu}L_{\nu},L_{\rho}\}(\partial_{\sigma}H)H^{\...
2
votes
0answers
444 views

Outer product using the quantum mathematica package

I am using the quantum Mathematica package and am trying to do computations that require me to use the outer (tensor) products of Pauli matrices. I would define this as, for example, ...
2
votes
0answers
109 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 ...
2
votes
0answers
474 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
205 views

How to solve system of differential equations of arbitrary order (symbolic tensors)?

I am interested in solving systems of ODEs symbolicly, keeping things with arbitrary dimensions for clarity. For example, assume that $x, f(x) \in R^N$ and $A \in R^{N \times N}$, how do I solve $f'(...
2
votes
0answers
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. ...
1
vote
0answers
50 views

How can I make NDSolve aware of vectorial nature of an ODE?

I am trying to solve the equilibrium equation $\text{DIV } \mathbf P(\textbf{u}(x,y)) = \mathbf{f}$, where $\mathbf P$ is the stress tensor defined by $$ \mathbf P = \mathbf F + (1-\det\mathbf F)^...
1
vote
0answers
56 views

LeviCivitaTensor contraction indices

My computer has problems when I try to perform a calculation with TensorContract. In particular, with the second answer to my previous question Contracting indices ...
1
vote
0answers
98 views

3d plot of young's modulus for anisotropic material

can anyone can help me in plotting 3d plot of young's modulus for anisotropic material. For input i have 6*6 stiffness tensor matrix and hydrostatic pressure value. I am trying with the following ...
1
vote
0answers
29 views

Derivatives with dummy indices not commutative after 3d derivative?

Recently I've encountered the following issue in xAct. I've defined the Manifold and tensors in the following manner Then consider the following expressions. In the case where there are 2 ...
1
vote
0answers
41 views

Inverse fuction of TensorExpand

Is there a way in mathematica to factorize/simplify a dot product? I.e. I have something like a.b + a.c (obviously more complicated expressions) and I would like to factorize terms like ...
1
vote
0answers
154 views

Evaluating covariant derivative for perturbed metric given background metric

I want to use Mathematica to evaluate an expression like; $h^{\alpha\beta}_{\,\,\,\,\,|\mu}h_{\alpha\beta\,|\nu} +\mbox{similar}$ where $h_{\alpha\beta}$ is the perturbation to a specified metric (...
1
vote
0answers
57 views

Typography of Mixed Tensor Index Notation

How can one properly and quickly write a mixed "tensor" such as $\Gamma{}_{1}{}^{2}{}_{3}$? Shortcuts such as esc Gamma esc, Ctrl+^, Ctrl+_ are prefered. I intendd to use this in an inline equation ...
1
vote
0answers
220 views

Solving the values of Christoffel symbols from a given metric tensor

Is there any easy mathematica package by which I can solve the Christoffel symbols from a given metric tensor?
1
vote
0answers
141 views

Tensor Contraction Speed Up (Matrix Product States)

I'm recently trying to implement some tensor contractions in Mathematica for use in Matrix Product State algorithms. Here's the operation I want to perform $$ M^{\sigma_{i}\sigma_{i}'[i]}_{(b_{i-1},...
1
vote
0answers
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 ...
1
vote
0answers
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 ...
1
vote
0answers
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 ...
1
vote
0answers
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 ...
1
vote
0answers
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 ...
1
vote
0answers
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. ...
1
vote
0answers
49 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
123 views

How does TensorReduce use assumptions?

I would like to use TensorReduce by assuming that certain patterns of functions are tensors. From documentation of TensorReduce: ...
0
votes
0answers
63 views

Transforming a tensor expression

I have the expression $\qquad\sqrt{\det[\gamma^{\mu \nu} F_{\mu \nu}]}$ Basiclly, I need to expand this expression in some form like : $trF^4 + (trF^2)^2 + \sqrt{\det[F_{\mu \nu}]}$, where $\gamma^{\...
0
votes
0answers
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: <...
0
votes
0answers
20 views

Coordinate transformation on the Christoffel tensor Xcoba

I have to compute the Christoffel Symbols on a basis which is not the coordinate basis of the chart in mathematica. I should do this contraction: ...
0
votes
0answers
37 views

Write Tensor Product in Matrix Form

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} } \...