Atan2 doesn't symplify as expected.



On 8/2/13 10:26 AM, Richard Hennessy wrote:
>
>
> -----Original Message----- From: Richard Fateman
> Sent: Thursday, August 01, 2013 5:13 PM
> To: David.Ronis at McGill.CA ; Mailing Maxima
> Subject: Re: [Maxima] Atan2 doesn't symplify as expected.
>
> It may not be something that Maxima (or some of
> its programmers)  apparently agrees with, but
> noting that   q   is greater than zero does not, mathematically speaking,
> tell you that sqrt(q)  is greater than zero.   The
> object  q  still has 2 square roots in general.
>
> Also, if nothing at all is known about q,
> sqrt(q^2),  which Maxima simplifies to abs(q),
> is nonsense as well,  since there are two values,
> q and -q,  neither of which is abs(q).
>
> RJF
>
> I don't think it is necessary to say one interpretation of sqrt(x^2) 
> is preferable than another, absolutely. 
If a system uniformly transforms sqrt(x^2) to abs(x) then it is likely 
to support simple various "proofs"
like -1 = 1.  Etc.
> The sqrt() function is going to be part of an argument to a Maxima 
> function that it is passed to by the user. 

If a user types in sqrt(x^2)  but means abs(x), then he is "in error" 
since they are not the same.
If a program computes a result including sqrt() without specifying which 
sqrt, then it is in error
unless it doesn't matter which sqrt.

> Clearly if you are working within the scope of pw.mac's (a package 
> with real numbers as it's main focus) integration command you have to 
> say sqrt(x^2) = abs(x) because integration requires a function as its 
> argument and functions by definition are single valued expressions.
This doesn't follow.  Sqrt() is ambiguous. It could be either of two 
single-valued functions.

Sometimes it helps to think:  does my program generalize to  (say) cube 
roots or 3/8 roots?

>   Given that, the user knows sqrt(x^2) is going to be, most likely 
> abs(x).
This makes sense in some very limited contexts. e.g. if you are given 
f(x):= sqrt(g(x)^2), and you know that
f(x)>=0  then abs(g(x)) is OK.   If you know that g(x)>0 THAT TELLS YOU 
NOTHING!!.

> If the user want to change that default interpretation they can always 
> change their input to -sqrt(x^2).
This misses the point, because -abs(x) is just as wrong as abs(x).. 
Neither is a solution to y^2=x^2.

> I don't think any user would expect an expression containing sqrt(x^2) 
> to be interpreted as -abs(x).

If an expression is 40 pages long, a user will not necessarily notice 
such details.  Basing the design
of a computer algebra system on what a programmer expects that
  a user will probably expect by "eyeballing' an expression is of
limited use.
RJF

>
> Rich
>