rjrosati / SymbolicTensors.jl

Manipulate tensors symbolically in Julia! Currently needs a SymPy dependency, but work is ongoing to change the backend to SymbolicUtils.jl
MIT License
32 stars 4 forks source link

`replace_with_arrays` is too picky about up/down indices #2

Open rjrosati opened 4 years ago

rjrosati commented 4 years ago

replace_with_arrays has sufficient information to work in cases like:

replace_with_arrays(A(i)*A(j)*field.metric(-i,-j), Dict(A(-i) => [0, 1], field.metric(i,j) => [1 0; 0 1]) )

This function should internally know that field.metric(-i,-j) is just inv([1 0; 0 1]), and that A(i) is just A(-j)*field.metric(i,j) == [0,1]' * [1 0; 0 1], but it gives an unspecified metric error.

This error is upstream and also exists in sympy.tensor.tensor. Should we rewrite replace_with_arrays?

rjrosati commented 4 years ago

This is a syntax issue, this seems to work just fine:

replace_with_arrays(A(i)*A(j)*field.metric(-i,-j), Dict(A(-i) => [0, 1], field => [1 0; 0 1]) )

Still, should we modify replace_with_arrays to be more friendly at all?