Le 29/01/2019 à 23:10, Federico Miyara a écrit :
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
logical, since
--> -1 - 0.499*%eps == -1
ans =
T
--> acos(-1 - 0.499*%eps)==%pi
ans =
T
S.
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
------------------------------------------------------------------------
Avast logo
<https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/www.avast.com/antivirus>
El software de antivirus Avast ha analizado este correo electrónico en
busca de virus.
www.avast.com
<https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/www.avast.com/antivirus>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
_______________________________________________
users mailing list
[email protected]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users