I have the following simple rules:
{x2-x1->s1,
-(x2-x1)->-s1,
x3-x2->s2,
-(x3-x2)->-s2}
I want to apply that rule to the following:
c*(x3-2*x2+x1)
and get obviously
c*(s2-s1)
How can I do that without explicitly creating that rule as well? I have tried including the rule {-2*x2->-x2-x2} as well but that gets change at definition time back to {-2*x2->-2*x2}.
As a bonus question how can I get {x2-x1->s1,-(x2-x1)->-(s1)} to work without having to explicitly include the second rule. Or, said another way, how can I get {x2-x1->s1} to transform x1-x2 to -s1.
Updated: to better reflect real case
x1, x2, x3
are at the left? $\endgroup$