With the version currently on github, you can enable experimental function evaluation using
kernel(call_embedded_python_functions=True)
You can then do
Rule:= { x -> asym( A B, {A,B} ) };
to get
Rule:= x -> 1/2 A B - 1/2 B A;
Please be aware that this is experimental. You can use any Python function here, including the ones that you define yourself. The arguments you will receive are always Ex
objects (so the A B
and {A, B}
above are passed to asym
as two Ex
objects, as required).
Note that the interface may change in the future because there may be unwanted side effects which I haven't yet grasped. (For instance, any function that is known on the python side will now get called, whether you want it or not. So if you were in the habit of writing sin(x)
in Cadabra expressions, instead of \sin(x)
, then turning this option on will produce an error, because Python's sin
function does not accept Ex
objects).
Feedback (more than) welcome.