simplification



Leon,

First, I think your expression should be

sqrt(a^2 - 2*a*b + b^2) + sqrt(a^2 + 2*a*b+b^2);

What you need to do is get "inside the square roots", and to factor.  The 
following code does this.

factor_bits(ex):=if atom(ex) then ex else apply(op(ex),maplist(lambda([ex2],factor_bits(factor(ex2))),args(ex)));

Chris


On Thu, 10 Feb 2011, leon.magiera at wp.pl wrote:

> Hi List
>
> Given
>
>    assume( a>0, b>0 )$
>
>    sqrt(a^2 - 2*a*b + b^2) + sqrt(a^2 - 2*a*b+b^2);
>
> How to simplify the above expression to the form
>
>     a+b+abs(a-b)
>
> Thanks in advance
> Leon
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>