2 years, 83 days

## Sorry...

@acer Sorry, I can't, I'm working on a restricted project, so any information breach can be severely sanctioned. Thank for you help, But I believe you solved my problem.

We can use this exmple :

restart;
expr := c*abs(x-x0) + d*abs(x-x0) + a*(x-x0) + b*x -b*x0 + abs(u) + e*abs(u) + c*x0 + g*x;
expr := c |x - x0| + d |x - x0| + a (x - x0) + b x - b x0 + |u|

+ e |u| + c x0 + g x

collect(expr, abs(x-x0));
(c + d) |x - x0| + a (x - x0) + b x - b x0 + |u| + e |u| + c x0

+ g x

collect(expr, abs);
(1 + e) |u| + (c + d) |x - x0| + a (x - x0) + b x - b x0 + c x0

+ g x

collect(exp, x-x0);
Error, (in collect) cannot collect x-x0
rev := v=x-x0;
temp := algsubs(x0=x-v, expr);
rev := v = x - x0

temp := c |v| + d |v| + e |u| + a v + b v - c v + c x + g x + |u|

eval( collect(temp, [v,x]), rev );
(a + b - c) (x - x0) + (c + g) x + c |x - x0| + d |x - x0|

+ e |u| + |u|

# now also target abs(x-x0)
eval( collect(temp, [v,x,abs(v)]), rev );
(a + b - c) (x - x0) + (c + g) x + (c + d) |x - x0| + e |u| + |u|

# now also target all abs calls
eval( collect(temp, [v,x,abs]), rev );
(a + b - c) (x - x0) + (c + g) x + (1 + e) |u| + (c + d) |x - x0|

## Problem with algsubs...

@acer First thank you for your proposition. The Problem with algsubs, if I have a lonely 'x0' in my exp, it will be replaced by "x - v", and I don't want this to happen.

Best Regards

## Problem solve...

@Carl Love  Thank you very much for this complete answer, and also for the tip.

 Page 1 of 1
﻿