Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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 appear to describe the following as tensor operations

Clear[a, b, x , y]
a = Array[x, 2]
b = Array[y, 2]
m = { {1, 0}, {0, 1}}
n = { {1, 0}, {0, -1}}
a . m . b
a . n . b

Here I am "contracting" two rank 1 tensors, using a Euclidean and Minkowski metric tensor respectively.

Is there a way to associate a desired metric tensor for a set of operations so that I can contract my vectors in a more natural way?

I suspect that the new builtin tensor support is supposed to be used differently than this (i.e. this doesn't seem like anything new, other than calling the array a tensor).

Also, is there a way to have this Array "tensors" display in an indexed fashion? How would you specify if the tensor variable is upper or lower indexed?

EDIT: It was pointed out in the comments that Assumptions can be used to declare a symbolic tensor, but it's not obvious to me how to make this do something useful. For example, if declare

$Assumptions = c \[Element] Matrices[{2, 1}, Reals] ; 
    $Assumptions = d \[Element] Matrices[{2, 1}, Reals] ;
$Assumptions = e \[Element] Matrices[{1, 2}, Reals] ;
    $Assumptions = f \[Element] Matrices[{1, 2}, Reals] ;

I'd assume one of these pairs of declarations (I'm not sure which), to be a rank 1 tensor with two elements, but if I try to contract this as I did above with the array declaration

c . n . d
e . n . f

I get:

c.{{1, 0}, {0, -1}}.d
e.{{1, 0}, {0, -1}}.f

respectively. I can also manually "declare" a subscript notation "tensor"

w = {Subscript[u, 1], Subscript[u, 2]} 
q = {Subscript[v, 1], Subscript[v, 2]} 

While I'm not sure how to declare this with Array, or some other less manual way, this at least solves the notation issue. I can then contract that with w. n . q yielding

$u_1 v_1-u_2 v_2$

Again, none of this looks like it is anything what I'd expect from the advertised new "native" version 9 support for tensors (something like what the Ricci package appears to support).

share|improve this question
    
The docs have information on symbolic tensors, which are set up using "Assumptions->". But I found no example for metrics, or for indexed notation. –  JxB Dec 23 '12 at 5:29
    
Perhaps this will be useful. –  Jens Dec 23 '12 at 7:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.