Hi Folks,
Here is a block of code that evaluates two expressions as functions of t.
{t,x,z}::Coordinate.
{i,j,k}::Indices(values={t,x,y,z}).
\partial{#}::PartialDerivative.
A::Depends{t}.
sub := {A_{x} = t, A_{y} = 2*t, A_{z} = 3*t};
abc := A_{i};
evaluate (abc, sub);
pqr := \partial_{t}{A_{i}};
evaluate (pqr, sub);
When you run this code you should notice two curious aspects of the results:
-
The y-component is missing in both expressions. If y is added into the ::Coordinate
property then the y-component is displayed for both expressions. I would have though that the evaluate command would use the values listed in the ::Index
property rather than the ::Coordinate
property to control the evaluation of objects.
-
In the second expression the subscripts on the squares contain a t. This suggests to me that Cadabra has taken the definition of the pqr object as a subset of components of an object with 2 subscripts (i.e., the pqr object is the {t i}
subset of the object \partial_{j}{A_{i}}
). This seems innocuous but as the next example shows this can cause serious problems. In this example Cadabra crashes (Python spits a segmentation fault).
{t,x,z}::Coordinate.
{a,b,c,d}::Indices(values={t,x,y,z}).
\partial{#}::PartialDerivative.
sub := { A{x} = t, A{y} = 2t, A_{z} = 3t};
Aa := A{a} + \partial{t}{A_{a}};
evaluate (Aa, sub);
My guess is that in the + operation Cadabra attempts to add a single index object with a double index object -- and it's no surprise that this leads to grief. One way to fix this problem is to not use \partial_{t}
directly but implicitly through a contraction as in the following example.
{t,x,z}::Coordinate.
{a,b,c,d}::Indices(values={t,x,y,z}).
\partial{#}::PartialDerivative.
sub := { D^{t} = 1, A_{x} = t, A_{y} = 2*t, A_{z} = 3*t};
Aa := A_{a} + D^{c}\partial_{c}{A_{a}};
evaluate (Aa, sub);
This works and gives the correct results. Note that the vector D^{a}
has just one component D^{t} = 1
so the construction D^{c} \partial_{c}
reduces to \partial_{t}
.
So after this long preamble I have my questions
-
Should the evaluate algorithm respect the indices listed in the ::Indices
or the ::Coordinate
property?
-
Should expressions like
Aa := A{a} + \partial{t}{A_{a}};
be legal?
-
If the components of A are known to depend on some parameter, say m, how can I teach Cadabra to correctly interpret
Aa := A{a} + \partial{m}{A_{a}};
where the parameter m is not a coordinate?
Sorry for the long post,
Cheers,
Leo