cadabra2 icon indicating copy to clipboard operation
cadabra2 copied to clipboard

Using two derivatives wih same object

Open slazav opened this issue 3 years ago • 2 comments

\nabla{#}::Derivative;
{A}::Depends(\nabla{#});

ex := \nabla{A};
unwrap(_);

\partial{#}::Derivative;
{A}::Depends(\partial{#});

ex := \nabla{A};
unwrap(_);

Result is 0 for the second unwrap. It looks like after {A}::Depends(\partial{#}); the dependence on \nabla is lost.

slazav avatar Jan 19 '22 13:01 slazav

Yes, that's intentional; properties overwrite previous properties of the same type. So instead do

A::Depends(\nabla{#}, \partial{#});

I'll convert this into an enhancement request ("please add functionality to amend an existing property") so we don't lose it, but it's not likely to get implemented soon

kpeeters avatar Jan 19 '22 13:01 kpeeters

Thanks, I just did not read manual for Depends carefully, it's written there.

By the way, am I right that SortOrder property does not overwrite previous one?

{A,B,C}::SortOrder;
ex := C A B;
sort_product(_);

{B,C,A}::SortOrder;
ex := C A B;
sort_product(_);

Here I have ABC in both cases. How sorting works if I have both definitions?

Anyway, it makes sense to define all properties once in the beginning and do not change them.

slazav avatar Jan 19 '22 13:01 slazav