7.3. ComponentValue and TensorValues with independent values

Until now, the second list of the FoldedRules contained only trivial replacement rules such as T_11T_11. It is very simple to specify values for the LHS, we just have to call ComponentValue with two arguments:

In[345]:=

ComponentValue[T[{1, -polar}, {2, -polar}], 5]

Added independent rule T_ (12)^  →5 for tensor T

Out[345]=

T_ (12)^  →5

In[346]:=

TensorValues[T, {{-polar, -polar}}]

Out[346]=

FoldedRule[{}, {T_ (12)^  →5}]

Notice what happens if we specify a dependent component

In[347]:=

ComponentValue[T[{1, -polar}, {0, -polar}], 6]

Added dependent rule T_ (10)^  →T_ (01)^   for tensor T

Added independent rule T_ (01)^  →6 for tensor T

Out[347]=

T_ (10)^  →6

First the dependent rule is added and then the value (with a possible sign) is assigned to the corresponding independent component:

In[348]:=

TensorValues[T, {{-polar, -polar}}]

Out[348]=

FoldedRule[{T_ (10)^  →T_ (01)^  }, {T_ (12)^  →5, T_ (01)^  →6}]

ComponentValue does not allow the user to introduce an inconsistent value

In[349]:=

ComponentValue[W[{1, polar}, {1, polar}, {1, polar}], 5]

Added dependent rule W_   ^(111) →0 for tensor W

Out[349]=

W_   ^(111) →0

We switch the rule generation messages off

In[350]:=

$CVVerbose = False ;

ComponentValue is threaded on pairs of lists when it has two arguments. This allows us to generate all independent rules with just one command.

In[351]:=

values = Table[i + j, {i, 1, 3}, {j, 1, 3}]

Out[351]=

{{2, 3, 4}, {3, 4, 5}, {4, 5, 6}}

In[352]:=

ComponentValue[ComponentArray[T[{a, polar}, {b, polar}]], values]

Out[352]=

In[353]:=

ColumnForm/@TensorValues[T, {{polar, polar}}]

Out[353]=


Created by Mathematica  (May 16, 2008) Valid XHTML 1.1!