Fix for bug [ 1370433 ] trigsimp(sqrt(%i2)) !=sqrt(trigsimp(%i2))?
Subject: Fix for bug [ 1370433 ] trigsimp(sqrt(%i2)) !=sqrt(trigsimp(%i2))?
From: Raymond Toy
Date: Fri, 10 Nov 2006 12:35:11 -0500
>>>>> "Robert" == Robert Dodier <robert.dodier at gmail.com> writes:
Robert> On 11/10/06, Andrey G. Grozin <A.G.Grozin at inp.nsk.su> wrote:
>> > (%i2) sqrt(x^2);
>> > (%o2) abs(x)
>> But this is wrong! maxima should stop doing this. For example, for
>> x = 1 + %i
>> with the standard cut along the negative real half-axis,
>> sqrt(x^2) = 1 + %i = x
>> but
>> abs(x) = sqrt(2)
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.
Ray