2.4. ToBasis

FreeToBasis[basis][expr,indices]            Convert free indices into basis indices
FreeToBasis[basis][expr,indices]            Change the basis of pairs of dummies
ToBasis[basis][expr,indices]                
Replace the indices in an expression by indices in the given basis

Safe replacement of basis indices.

We may want to replace the indices in an expression by indices in a different basis.  Sometimes this is easy enough

In[191]:=

SeparateBasis[polar][v[a] v[-a]]

Out[191]=

e_a ^( b) e_ ( c)^a  v_b^  v_ ^c

In[192]:=

%//ContractBasis

Out[192]=

v_a^  v_ ^a

And it may seem that the ReplaceIndex function could take care of the more difficult situations. But we must watch for pitfalls such as

In[193]:=

ReplaceIndex[v[a] PD[-b][v[-a]], {a→ {a, polar}, -a→ {-a, -polar}}]

Out[193]=

v_ ^a ∂_b^ v_a^

This is wrong, because
    v^b∇_a v_b = (v^ce^( b) _c) ∇_a(e_b^dv_d) ≠ v^b∇_a v_b
We can arrive at the correct result via a roundabout way, with Contract and SeparateBasis

In[194]:=

SeparateBasis[polar][v[a] PD[-b][v[-a]]]//ScreenDollarIndices

Out[194]=

e_ ( c)^a  v_ ^c (e_b ^( e) Γ[] _ ( ea)^d   v_d^ + e_a ^( d) e_b ^( f) ∂_f^ v_d^ )

In[195]:=

ContractBasis[%]

Out[195]=

Γ[] _ ( bc)^d   v_ ^c v_d^ + v_ ^d ∂_b^ v_d^

The functions *ToBasis automate this process

In[196]:=

DummyToBasis[polar][v[a] PD[-b][v[-a]]]//Simplification

Out[196]=

Γ[] _ ( bc)^a   v_a^  v_ ^c + v_ ^a ∂_b^ v_a^

Notice how the derivative of the Basis object has been replaced by the appropriate Christoffel. Further examples:

In[197]:=

expr = S[-A, B] v[a] v[c] v[-c]

Out[197]=

S_A ^( B) v_ ^a v_c^  v_ ^c

In[198]:=

FreeToBasis[cartesian][%]

Out[198]=

S_A ^( B) v_c^  v_ ^c v_ ^a

In[199]:=

ToBasis[cartesian][%]

Out[199]=

S_A ^( B) v_ ^a v_b^  v_ ^b

In[200]:=

FreeToBasis[comp][%]

Out[200]=

S_A ^( B) v_ ^a v_b^  v_ ^b

In[201]:=

ToBasis[polar][%, {a, cartesian}]

Out[201]=

S_A ^( B) v_ ^a v_b^  v_ ^b

Many times we have expressions such as

In[202]:=

T[{-a, -polar}, {-b, -polar}] v[{a, polar}] v[{b, polar}]

Out[202]=

T_ (ab)^   v_ ^a v_ ^b

where we had defined T_ab to be antisymmetric. Therefore this is zero:

In[203]:=

Simplification[%]

Out[203]=

0

However, if we have

In[204]:=

v[-a] v[a] - v[{-a, -polar}] v[{a, polar}]

Out[204]=

v_a^  v_ ^a - v_a^  v_ ^a

In[205]:=

Simplification[%]

Out[205]=

v_a^  v_ ^a - v_a^  v_ ^a

we have to change the whole expression to a single basis first

In[206]:=

ToBasis[AIndex][%]

Out[206]=

0


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