Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
0 votes

Hello, I am a newbie, and encountered this problem, which I suspect is due to my unfamiliar with the syntax but cannot see how to fix.

When I declare {x,y} as coordinates, \partial{#} as partial derivative w.r.t. all coordinates, f to depend only on x and g on y; I am expecting the unwrap function to move the derivative w.r.t. x pass g and the derivative w.r.t. y pass f, but this does not happen. My code:

{x,y}::Coordinate.
\partial{#}::PartialDerivative.
f::Depends(\partial{x}).
g::Depends(\partial{y}).
ex:=\partial_{x}{A*f*g};
unwrap(_);
ex:=\partial_{y}{A*f*g};
unwrap(_);

In both cases I am getting A\partial_{x}{fg} and A\partial_{y}{fg}, but expecting Ag*\partial_{x}{f}

EDIT: formation

in General questions by (220 points)

1 Answer

0 votes

It's a bug :-( That is to say, your code should have read

{x,y}::Coordinate.
\partial{#}::PartialDerivative.
f::Depends(x).
g::Depends(y).
ex:=\partial_{x}{A*f*g};
unwrap(_);
ex:=\partial_{y}{A*f*g};
unwrap(_);

(changed the two Depends lines) but even then it would produce the wrong answer.

This got introduced in the 1.x -> 2.x rewrite and somehow escaped the tests. I have just pushed a fix to github now which fixes this.

by (82.6k points)
...