kpeeters / cadabra2

A field-theory motivated approach to computer algebra.
https://cadabra.science/
GNU General Public License v3.0
216 stars 37 forks source link

Accent and tensors #105

Closed MichaelaLawrence closed 6 years ago

MichaelaLawrence commented 6 years ago

It appears that the Accent property does not work with tensor objects, for example,

x::Coordinate.
{a, b}::Indices(position=free).
{a, b}::Integer(0..3).

g_{a b}::Metric.
g^{a b}::InverseMetric.

g^{\mu?}_{\nu?}::KroneckerDelta.
g_{\mu?}^{\nu?}::KroneckerDelta.

\hat{#}::Accent.

exampleone:=\hat{g}^{a b}*\hat{g}_{a b}:

eliminate_metric(_)
eliminate_kronecker(_);

I was expecting the above code to yield the result of 4, but instead the following is returned,

\hat{g}^{a b} \hat{g}_{a b}

Is Accent only intended to be used with scalar objects? There is an easy enough work around for this by just substituting tensor objects with accents to the same objects without accents, performing the calculation and then substituting back again.

kpeeters commented 6 years ago

This is supposed to work with

\hat{g^{a b}} \hat{g_{a b}};

Unfortunately, that triggers a different bug. Thanks, will fix.

kpeeters commented 6 years ago

Now fixed on github, 8993032f84a86c1924730cabeecbd10a7fa72fe6.