kpeeters / cadabra2

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

canonicalise with numeric indices #245

Closed slazav closed 6 months ago

slazav commented 2 years ago
{a,b,c}::Indices;
{a,b,c}::Integer(1..3);

ex := (n_{3})**2 n_{a};
canonicalise(_);

Result: RuntimeError: Internal error in fill_index_position_map; cannot find index 1.

Sorry for so many issues. I'm trying to apply this program to my calculations and still can't go through such things:)

slazav commented 2 years ago

Similar problem with epsilon_to_delta:

{a,b,c,i,j,k}::Indices;
{a,b,c,i,j,k}::Integer(1..3);
{d{#}}::KroneckerDelta;
{e_{a b c}}::EpsilonTensor(delta=d);
ex := e_{a j 3} e_{a k 3} n_{j} n_{k};
epsilon_to_delta(_);

Result: RuntimeError: No dimension known for summation index. Expected: n_{k} n_{k}-n_{3} n_{3}

kpeeters commented 2 years ago

The second issue is resolved through a different bug fix. The first one is due to the power appearing in your expression. Canonicalise really isn't meant for that, and should probably refuse to work on expressions which contains powers of tensor components, but you can get around it by first calling expand_power.

kpeeters commented 6 months ago

These seem to work now as expected, feel free to re-open the issue if this is still a problem.

slazav commented 6 months ago

Thank you, I will check it!