Fix for bug [ 1370433 ] trigsimp(sqrt(%i2)) !=sqrt(trigsimp(%i2))?
Subject: Fix for bug [ 1370433 ] trigsimp(sqrt(%i2)) !=sqrt(trigsimp(%i2))?
From: Robert Dodier
Date: Fri, 10 Nov 2006 13:55:38 -0700
On 11/10/06, Raymond Toy <raymond.toy at ericsson.com> wrote:
> Robert> Here Maxima is making an unstated assumption that symbols
> Robert> represent real variables unless declared complex.
> Robert> (declare(y, complex), sqrt(y^2)) => sqrt(y^2)
> Robert> I don't know if that policy is followed 100%.
>
> This is also controlled by the domain variable. The default is real,
> so sqrt(x^2) -> abs(x). If the domain is complex, sqrt(x^2) remains.
domain is probably something we should just cut out.
Although the name suggests some far-reaching effects,
it is documented only to affect sqrt (although of course
there might also be some undocumented effects).
Also, domain interacts badly with declarations --
declare (x, real);
domain : complex;
sqrt (x^2);
=> sqrt(x^2); /* OOPS */
Surely the explicit declaration of x should supersede the
general assumption implied by domain : complex .
On a related note, I am convinced that we need to reconsider
Maxima's declaration system in general, and stuff related to
complex variables in particular.
All the best
Robert