Stephane,

However, I must say that acos(1-%eps) gives on my Scilab 6.0.1
(Windows 7, i7 processor) a result of
Federico, you have to try 1+%eps or -1-%eps !

acos(x) with x > 1 is indeed imaginary, so there is no unexpected result.

However, I see now that it hadn't been said that in-domain arguments
yielded complex results but -1 - %eps was the culprit.

But, for instance,

min([-1-%eps, -1-%eps*2/3, -1, -1+ %eps, -0.9]) >= -1

is false (on my system), so the test performed by Paul Carrico would not
succeed if there were a -1-%eps among the values of the vector.

Only when alpha*%eps  with alpha < 0.5 is the minimum the test is
successful, but in such case acos() yields a value close to %pi, not a
complex value

--> acos(-1 - 0.499*%eps)
 ans  =

   3.141592653589793100000

When alpha > 0.5 the test is not successful nor is the acos() real:

--> acos(-1 - 0.50000001*%eps)
 ans  =

   3.141592653589793100000 - 0.000000021073424255447i

(this is a binary rounding situation since %eps is 2^-52)

I think the original question is not completely solved. Why a number
that is not smaller to -1 (asuming the min test is successful) yields a
complex acos?

An why it does in some systems and not in others? (Assuming Paul's
report is accurate)

There is another situation where this happens, when an fft is performed
on a real signal, then filtered in the frequency domain and then the
ifft is applied. The result should be real, but sometimes there are
small imaginary parts.

In this case there is a reason, complex exponentials are used in the
algorithm so arithmetioc errors may not completely cancel out because of
arithmetic and precision issues.

Federico Miyara


---
El software de antivirus Avast ha analizado este correo electrónico en busca de 
virus.
https://www.avast.com/antivirus
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to