In this answer it is explained how to avoid args
to be sorted in SymPy classes like Mul
, Add
and so on.
For a new created class like this one explained here it can go to the right hand side when multiplied by a sympy.core.numbers.Float
, sympy.core.numbers.Pi
or sympy.core.numbers.Integer
, for example, giving:
print D(x) * 1.
1.0*D(x)
The original expression gives 0.
when evaluated, while the new one gives D(x)
.
In order for this differential operator to work properly, it must stay on the left hand side:
print D(x) * 1.
D(x)*1.0
Is there any hidden parameter, like _op_priority
for changing __mul__()
priority, that tells SymPy the type that stays more to the left or to the right?