Am Samstag, den 26.02.2011, 21:28 -0500 schrieb Stavros Macrakis:
> In the first case, the general simplifier has already simplified the
> expression by the time radcan sees it:
>
> (%i5) sqrt((x+1)^2);
> (%o5) abs(x + 1)
>
> radcan intentionally treats sqrt(x) as meaning *either* the positive
> or negative square root, so doesn't return abs. But in this case, the
> abs has already been introduced by the general simplifier.
>
> -s
>
> On Sat, Feb 26, 2011 at 05:51, Lo?c <xlogo at free.fr> wrote:
> Hi list
>
> I don't understand some simplifications with radcan:
>
> (%i5) radcan(sqrt((x+1)^2));
> (%o5) abs(x + 1)
> (%i6) radcan(sqrt(x^2+2*x+1));
> (%o6) x + 1
>
> Seems to be a bug, no?
The simplification sqrt(x^2) -> abs(x) is switched on by default. This
is controlled by the global option variable radexpand. The default value
is true. At a lot of places in the code, this simplification is not the
desired behavior and the option variable radexpand is bound to false.
With this setting the simplification is more correct in general.
Furthermore, the documentation of radexpand must be improved. The flag
controls in general the simplification of expressions like (x^a)^b.
There are some hacks, which influence the simplification of (x^a)^b in
addition. This is necessary to get some pieces of code to work.
A more correct implementation might be, to switch off the default
behavior, that sqrt(x^2) simplifies to abs(x). In Sage this is done by
setting the option variable domain to complex. A more consistent
behavior could be achieved by setting the variable radexpand to the
value false by default.
Dieter Kaiser