JuliaSymbolics/SymbolicUtils.jl

`@arithmetic_rule`

shashi opened this issue · 1 comments

shashi commented

Have a macro

@arithmetic_rule $(D(r)) * ~x => ...

such that it matches,

D(r) * a * b with ~x as a*b
(D(r) * b) / a with ~x as b/a

Also similarly enable:
D(x) * ~y + ~x

This should simplify writing redundant rules in MethodOfLines.jl

shashi commented

One idea is to just add multipleof predicate, and make it more powerful by allowing slots in predicate.

@rule ~x::multipleof(~y) + ~z::multipleof(~y) => ~y * (~x / ~y + ~z/~y)