How to create symbolic rewrite rules with new variables?

Hi all,

I am not sure where to put this topic, and I am still fairly new to Julia. So I put it in “New to Julia”. :sweat_smile:

I was playing around with symbolic-utils a little. I like the straight forward rule-based rewriting approach.
But I found no way to introduce new variables in the rewrite rules.

Something like:

x[1]x[2]x[3] = x[1]*(y_2_3)+Term(y_2_3,x[2],x[3])

In words:
Replace all cubic polynomials with a quadratic one by introducing a new variable y and an additional Term. Preferably, the new variable name should reflect the variables it did replace.

A simpler example:

x[1]^2+x[2]^2 = (r_1_2)^2

Is there any easy way to do this?

Open an issue for this one.