I tried to isolate terms with a certain order of derivation by defining a Weight
property to the derivative.
(x, y)::Coordinate.
(i, j)::Indices(values={x, y}, position=fixed).
\nabla{#}::Derivative.
h_{i j}::Depends(x, y, \nabla{#}).
\delta{#}::KroneckerDelta:
\nabla{#}::Weight(label=order, value=1);
\nabla{#}::WeightInherit(label=order, type=additive);
Then, a test expression
test := A \delta_{i j} + h_{i j}
+ \nabla_{x}{h_{i j}}
+ B \nabla_{y}{h_{i j}}
+ C \nabla_{x}{ \nabla_{y}{ h_{i j} } }
+ \nabla_{x}{ \nabla_{x}{ h_{i j} } };
Finally, I'd like to define terms with a certain order on derivatives,
term0 := @(test).
keep_weight(_, $order=0$);
term1 := @(test).
keep_weight(_, $order=1$);
term2 := @(test).
keep_weight(_, $order=2$);
It results in the
The zeroth order is Ok, but the first and second yield problems.
Question
What is the right way (if any) of providing Weight
to a derivative operator?
P.D.: The same occurs with the PartialDerivative
or by changing the WeightInherit
type to multiplicative.