[Scilab-users] [EXTERNAL] Re: acos leads to complex values
Stéphane Mottelet
stephane.mottelet at utc.fr
Tue Jan 29 21:16:19 CET 2019
Le 29/01/2019 à 20:48, Federico Miyara a écrit :
>
> I think it would be interesting to include an input argument check in
> some functions prone to give complex results in limiting cases (such
> as acos or asin) so that if inside the domain (to within 1 %eps) where
> the output argument should be real the imaginary part is canceled.
> Something like this for scalars:
>
> function y=acos1(x)
> if isreal(x)
> if -1<=x & x<=1
> y = real(acos(x))
> else
> y = acos(x)
> end
> end
> endfunction
>
> 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 !
>
> 0.000000021073424255447,
>
> being %eps
>
> 0.0000000000000002220446
>
> I get no imaginary part. I guess there must be some dependency on the
> arithmetic engine.
>
>
> Federico Miyara
>
>
> On 29/01/2019 12:58, Stéphane Mottelet wrote:
>> It is the same if x is slightly > 1:
>>
>> --> x=1+%eps
>> x =
>>
>> 1.
>>
>>
>> --> acos(x)
>> ans =
>>
>> 2.107D-08i
>>
>> --> format(25); x
>> x =
>>
>> 1.0000000000000002220446
>>
>> Le 29/01/2019 à 16:55, Carrico, Paul a écrit :
>>>
>>> When I scroll to the list, the lowest (positive) value is 8.4^E -08
>>> (works fine) and no %eps .
>>>
>>> How Can I check if %eps is in?
>>>
>>> *De :*users [mailto:users-bounces at lists.scilab.org] *De la part de*
>>> Stéphane Mottelet
>>> *Envoyé :* mardi 29 janvier 2019 16:50
>>> *À :* users at lists.scilab.org
>>> *Objet :* [EXTERNAL] Re: [Scilab-users] acos leads to complex values
>>>
>>> Le 29/01/2019 à 16:45, Carrico, Paul a écrit :
>>>
>>> Dear All
>>>
>>> I spent some time in looking for a mistake in my code ; finally
>>> I’ve found that the ACOS of a real vector leads to some complex
>>> values (???)
>>>
>>> acos(Scar_P(:,1)./CM_x_CN(:,1))
>>>
>>> Are your really sure, because we may have
>>>
>>> --> x=-1-%eps
>>> x =
>>>
>>> -1.
>>>
>>>
>>> --> acos(x)
>>> ans =
>>>
>>> 3.1415927 - 2.107D-08i
>>>
>>> S.
>>>
>>> (the formula worked so far)
>>>
>>> I checked that the input values are correct:
>>>
>>> -Comprised between [-1; 1] using MIN and MAX
>>>
>>> -Composed only of real values using ISREAL (all the vectors are
>>> correct)
>>>
>>> Thus I do not understand why complex values appear ?
>>>
>>> May it come from the vectorization ?
>>>
>>> Paul
>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> users mailing list
>>>
>>> users at lists.scilab.org <mailto:users at lists.scilab.org>
>>>
>>> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users <https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/urldefense.proofpoint.com/v2/url?u=https-3A__antispam.utc.fr_proxy_1_c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy_lists.scilab.org_mailman_listinfo_users&d=DwMG-g&c=0hKVUfnuoBozYN8UvxPA-w&r=4TCz--8bXfJhZZvIxJAemAJyz7Vfx78XvgYu3LN7eLo&m=rN8DsnGalih7CBHModSb9evOi3rmZRFFYcBFHTC71gU&s=RgKyyESZ7uSTxlU7V0nR42XTJybjC0Ar5fDcrouQThE&e=>
>>>
>>> --
>>> Stéphane Mottelet
>>> Ingénieur de recherche
>>> EA 4297 Transformations Intégrées de la Matière Renouvelable
>>> Département Génie des Procédés Industriels
>>> Sorbonne Universités - Université de Technologie de Compiègne
>>> CS 60319, 60203 Compiègne cedex
>>> Tel : +33(0)344234688
>>> http://www.utc.fr/~mottelet <https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/urldefense.proofpoint.com/v2/url?u=http-3A__www.utc.fr_-7Emottelet&d=DwMG-g&c=0hKVUfnuoBozYN8UvxPA-w&r=4TCz--8bXfJhZZvIxJAemAJyz7Vfx78XvgYu3LN7eLo&m=rN8DsnGalih7CBHModSb9evOi3rmZRFFYcBFHTC71gU&s=34gC0H3RYWxwcKp7fr4bR5XFfy1acxO72YI9AYJJFhA&e=>
>>>
>>> _______________________________________________
>>> users mailing list
>>> users at lists.scilab.org
>>> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
>>
>>
>> --
>> Stéphane Mottelet
>> Ingénieur de recherche
>> EA 4297 Transformations Intégrées de la Matière Renouvelable
>> Département Génie des Procédés Industriels
>> Sorbonne Universités - Université de Technologie de Compiègne
>> CS 60319, 60203 Compiègne cedex
>> Tel : +33(0)344234688
>> http://www.utc.fr/~mottelet
>>
>>
>> _______________________________________________
>> users mailing list
>> users at lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
>
>
>
> ------------------------------------------------------------------------
> 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
> users at lists.scilab.org
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20190129/943a237d/attachment.htm>
More information about the users
mailing list