Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
0 votes

Hi Folks,

I think I might be doing something wrong so any help would (as always) be appreciated.

The following code should produce answers that differ only in the use of a bar accent in the first expression. But the first expression returns \bar{A}^{a}_{a} \bar{A}^{b}_{b} which is clearly wrong -- somehow the indices have migrated across factors in the product.

Am I using the \bar accent correctly?

Cheers, Leo

{a,b,c,d#}::Indices(position=independent).
\bar{#}::Accent.

A_{a b}::Depends(\bar{#}).
A^{a b}::Depends(\bar{#}).

A_{a b}::Symmetric.
A^{a b}::Symmetric.

\bar{A}_{a b}::Symmetric.
\bar{A}^{a b}::Symmetric.

ex := \bar{A}_{a b} \bar{A}^{b a};
canonicalise (ex);

ex := A_{a b} A^{b a};
canonicalise (ex);
in Bug reports by (1.6k points)

1 Answer

0 votes

It sounds like I am using the wrong type of index iterator somewhere in the canonicalise algorithm. Anyway, it's a bug, this is supposed to work. Will investigate.

by (80.3k points)

Thanks Kasper.

Hi, I get weird behavior of canonicalise with anti-symmetric tensors.

Was this issue fixed, and at what release version?

[\bar{\epsilon}_{\mu \nu \rho},\bar{\epsilon}^{\mu \nu \rho}]::AntiSymmetric;
test := \bar{\gamma}^{\sigma \kappa} \bar{\epsilon}_{\mu \kappa \nu} 
- \bar{\gamma}^{\sigma \kappa} \bar{\epsilon}_{\mu \nu \kappa};
canonicalise(test);

This returns 0

This remains unresolved, lack of time, and then it got snowed under. I have now added an issue on the github issue tracker so it doesn't get lost again.

https://github.com/kpeeters/cadabra2/issues/284

Thanks Kasper. Currently I'm trying to write a patch-code that will

  1. take an expression and replace in each term all symbols with a bar-accent into the symbols without the accent (assuming there aren't such already with the same symbol)
  2. run the normal canonicalise
  3. replace back the symbols to be with the bar-accent

The latest bug I need to deal with is to identify coefficients and signs before doing a replacement of a symbol, or they will turn into a positive +1 coefficient of any term in the expression... I tried using ExNode.factors() but it doesn't seem to hold this info. Can you help?

Why don't you just use a custom symbol together with a LaTeXForm property? E.g.

{a,b,c,d#}::Indices(position=independent).

bA_{a b}::Symmetric.
bA^{a b}::Symmetric.
bA{#}::LaTeXForm("\bar{A}").

ex := bA_{a b} bA^{b a};
canonicalise(ex);

This will print as $\bar{A}_{ab} \bar{A}^{ab}$ but avoid the bug.

It seems I need to do a custome symbol for any variable, not only A. My goal is to do calculations for 3+1 foliation with normal tensors and tangnent tensors - I have multiple variabels that are tangent and I want to mark all of them with a bar accent. then I can make rules like:

cond_normal := [n^{\mu} n_{\mu} -> (-1), n_{\mu} n^{\mu} -> (-1), 
\bar{A?}^{\mu} n_{\mu} -> 0, \bar{A?}_{\mu} n^{\mu} -> 0];

This bug is now fixed in github.

Thanks, that's great. I see in github that the latest master was updated recently.

I run Cadabra2 via jupyterhub and I've never done an update to the Cadabra code. Should I simply clone the latest master from github and run the make and install commands?

If you built cadabra from source before, do git pull to bring it up to the latest and then make and sudo make install.

I have just updated cadabra on the cloud version as well.

So, after installing the update, I think that the issue remains:

In the following code, the result for the variables with the accent is 0 instead of a non-zero correct answer as that for the variables without the accent.

[\bar{\epsilon}_{\mu \nu \rho},\bar{\epsilon}^{\mu \nu \rho}]::AntiSymmetric;
test := \bar{\gamma}^{\sigma \kappa} \bar{\epsilon}_{\mu \kappa \nu} - \bar{\gamma}^{\sigma \kappa} \bar{\epsilon}_{\mu \nu \kappa};
canonicalise(test);
[\epsilon_{\mu \nu \rho},\epsilon^{\mu \nu \rho}]::AntiSymmetric;
test := \gamma^{\sigma \kappa} \epsilon_{\mu \kappa \nu} - \gamma^{\sigma \kappa} \epsilon_{\mu \nu \kappa};
canonicalise(test);

Then you are not running the current version, as I get the correct result for both.

I did some more testing and I think that the new version works partly. Here's an example that I don't know why there's a difference in results:

[\bar{\gamma}_{\mu \nu},\bar{\gamma}^{\mu \nu}]::Symmetric;
[\bar{\epsilon}_{\mu \nu \rho},\bar{\epsilon}^{\mu \nu \rho}]::AntiSymmetric;

test := \bar{\gamma}^{\sigma \kappa} \bar{\epsilon}_{\mu \kappa \nu} - 
\bar{\gamma}^{\sigma \kappa} \bar{\epsilon}_{\mu \nu \kappa};
canonicalise(test);

test := \bar{A}^{\sigma \kappa} \bar{\epsilon}_{\mu \kappa \nu} - 
\bar{A}^{\sigma \kappa} \bar{\epsilon}_{\mu \nu \kappa};
canonicalise(test);

The result with bar{A} are non-zero and correct while the results with \bar{\gamma} are 0. Note that I assert symmetric for gamma but not for A, and it shouldn't affect the result Am I missing here something?

I can't reproduce that. With the current version on github both give the correct result.

So... I tested my code on the proper Cadabra interface on my machine (without jupyterhub) and it works fine.

I found that the jupyterhub server (tljh) is somehow still running the older cadabra library and isn't using the new build... sorry for all of the confsion.

...