Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Using cadabra to calculate antisymmetric tensor field

  1. Sep 16, 2011 #1
    I was searching for a software that can calculate the tensor. I found in this forum some people suggest Cadabra (http://cadabra.phi-sci.com/) to calculate the tensors for relativity and field theory.
    Can anyone help me how can I calculate the product of two antisymmetric tensor using Cadabra? like this:

    [tex]\frac{1}{12}G_{\mu\nu\rho}G^{\mu\nu\rho}=\frac{1}{12}(\partial_{\mu}\phi_{\nu\rho}+\partial_{\nu} \phi_{\rho\mu}+\partial_{\rho}\phi_{\mu\nu})( \partial^{\mu}\phi^{\nu\rho}+\partial^{\nu}\phi^{ \rho \mu}+\partial^{\rho}\phi^{\mu\nu})[/tex]

    Here [tex] \phi_{\mu\nu} [/tex] is antisymmetric tensor
  2. jcsd
  3. Sep 17, 2011 #2


    User Avatar
    Science Advisor

    That should be quite straightforward in Cadabra (after one has studied the documentation). There are several tutorial notebook files on the Cadabra website, and also some examples in the main documentation (also available on the website).

    Since you didn't post your Cadabra notebook file (nor even a fragment), I have no idea what difficulty you're having. Maybe if you tell me which of the Cadabra example notebooks you've downloaded and tried, and what documentation you've already studied, I could say something more helpful.

    [Edit: why are you trying to calculate this using Cadabra anyway? It can be done easily enough by hand since there's only 9 terms in the product. Or are you just doing a simple example to see how Cadabra works?]
  4. Sep 18, 2011 #3
    That is what I did-
    Are my steps correct?

    Actually these 9 terms are not my final result. I have posted the general formate of the equation. After the multiplication, I have to separate the terms in time and space coordinates. It will give me about 12-14 separate terms from each of the 9 terms (total of 9x14=126 terms). So I think cadabra is my best bet for calculating this.
  5. Sep 18, 2011 #4


    User Avatar
    Science Advisor

    Firstly, I don't think you need the explicit @asym command, because if you instead give \phi the AntiSymmetric property, G is then antisymmetric automatically.

    Second, in your

    you forgot that the "%" means "the previous expression". So your @substitute command is actually applying the G substitution specification to G itself.

    Also, your substitution specification is only for contravariant G, so it won't work on the covariant G. However, if you don't care about metric signature you can put all the indices downstairs.

    Doing the above, and a few more things, I worked it out this way:

    {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u#}::Indices.
    \phi_{a b}::AntiSymmetric.

    G := G_{a b c} -> \partial_{a}\phi_{b c}+\partial_{b}\phi_{c a}+\partial_{c}\phi_{a b};

    GG := G_{a b c} G_{a b c};


    and I get the result:
    GG := 3\, {\partial}_{a} {\phi}_{b c} {\partial}_{a} {\phi}_{b c} + 6\, {\partial}_{a} {\phi}_{a b} {\partial}_{c} {\phi}_{b c};

    I guess this means metric signature matters for you, so you'll need to be more careful with upstairs/downstairs indices. You could possibly still use only covariant G and then introduce 3 Minkowski metric factors to perform the contraction. (Read up on the "Metric" property. Also the @eliminate_metric and @eliminate_kr, commands, and related stuff.) Cadabra has features to deal with separated time/space indices (IIRC), but I haven't used them so I can't offer much help there. I think one of the tutorials gives an example though.)

    Last edited: Sep 18, 2011
  6. Sep 19, 2011 #5
    Thanks thats really helpful.
    But if I want to calculate

    GG := G_{a b c} G^{a b c};

    How can I substitute the term 'G^{a b c}' with upper indices? I mean
    G := G^{a b c} -> \partial_{a}\phi^{b c}+\partial_{b}\phi^{c a}+\partial_{c}\phi^{a b};

    Because declaring

    G := G_{a b c} -> \partial_{a}\phi_{b c}+\partial_{b}\phi_{c a}+\partial_{c}\phi_{a b};

    Only substitute G_{a b c}.
    Is there anyway that I can substitute both G_{a b c} and G^{a b c}? And give me the final result?
  7. Sep 19, 2011 #6
    Ok, I figured it out :smile: . I have to declare two substitution by two different name-

    GaG := G_{a b c} -> \partial_{a}\phi_{b c}+\partial_{b}\phi_{c a}+\partial_{c}\phi_{a b};

    GbG := G^{a b c} -> \partial^{a}\phi^{b c}+\partial^{b}\phi^{c a}+\partial^{c}\phi^{a b};

    Then substitute them by two different command.


    Thank you for your help :smile:
  8. Sep 19, 2011 #7


    User Avatar
    Science Advisor

    I just noticed one more possible problem. If (later) you want to treat
    \partial_{a} as a genuine partial derivative, e.g., by adding lines
    like these near the start:

    \phi_{a b}::Depends(\partial).

    then you'll need to enclose the argument of \partial_{a} in braces.
    Thus, your

    \partial_{a}\phi_{b c}

    should be

    \partial_{a} {\phi_{b c}}


    (Neglecting to do this causes a problem later in @canonicalise.)
  9. Sep 19, 2011 #8
    Yes, when I have run the command @canonicalise!(@); it got stuck. Adding the bracket solve my problem. Thank you. :smile: :smile:
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook