[Scilab-users] [EXTERNAL] Re: acos leads to complex values

Carrico, Paul paul.carrico at esterline.com
Tue Jan 29 19:15:09 CET 2019


Stephane pointed out on the issue : after calculation and prior to the Acos one, some values were "1.0000000000000002220446" leading to "acos = 2.107D-08i" ; in addition he suggested me to use something like "acos(max(-1,min(1,-1.0000000000000002220446)))" or "acos(max(-1,min(1,1.0000000000000002220446)))" ... very smart :)

Thanks

Paul





EXPORT CONTROL :
Cet email ne contient pas de données techniques
This email does not contain technical data

De : users [mailto:users-bounces at lists.scilab.org] De la part de Stéphane Mottelet
Envoyé : mardi 29 janvier 2019 16:59
À : users at lists.scilab.org
Objet : Re: [Scilab-users] [EXTERNAL] Re: acos leads to complex values

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.4E-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<mailto: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://urldefense.proofpoint.com/v2/url?u=https-3A__antispam.utc.fr_proxy_2_c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy_urldefense.proofpoint.com_v2_url-3Fu-3Dhttps-2D3A-5F-5Fantispam.utc.fr-5Fproxy-5F1-5Fc3RlcGhhbmUubW90dGVsZXRAdXRjLmZy-5Flists.scilab.org-5Fmailman-5Flistinfo-5Fusers-26d-3DDwMG-2Dg-26c-3D0hKVUfnuoBozYN8UvxPA-2Dw-26r-3D4TCz-2D-2D8bXfJhZZvIxJAemAJyz7Vfx78XvgYu3LN7eLo-26m-3DrN8DsnGalih7CBHModSb9evOi3rmZRFFYcBFHTC71gU-26s-3DRgKyyESZ7uSTxlU7V0nR42XTJybjC0Ar5fDcrouQThE-26e-3D&d=DwMG-g&c=0hKVUfnuoBozYN8UvxPA-w&r=4TCz--8bXfJhZZvIxJAemAJyz7Vfx78XvgYu3LN7eLo&m=gwQYJePMwf66Qkf2heyo1UqhkxA31D8XuF0dNsmnvOg&s=WFlVbPNytDi1qDLq35P7qeSGnwD6PCRMRL4tKAtS9no&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://urldefense.proofpoint.com/v2/url?u=https-3A__antispam.utc.fr_proxy_2_c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy_urldefense.proofpoint.com_v2_url-3Fu-3Dhttp-2D3A-5F-5Fwww.utc.fr-5F-2D7Emottelet-26d-3DDwMG-2Dg-26c-3D0hKVUfnuoBozYN8UvxPA-2Dw-26r-3D4TCz-2D-2D8bXfJhZZvIxJAemAJyz7Vfx78XvgYu3LN7eLo-26m-3DrN8DsnGalih7CBHModSb9evOi3rmZRFFYcBFHTC71gU-26s-3D34gC0H3RYWxwcKp7fr4bR5XFfy1acxO72YI9AYJJFhA-26e-3D&d=DwMG-g&c=0hKVUfnuoBozYN8UvxPA-w&r=4TCz--8bXfJhZZvIxJAemAJyz7Vfx78XvgYu3LN7eLo&m=gwQYJePMwf66Qkf2heyo1UqhkxA31D8XuF0dNsmnvOg&s=Z35_aByfKODglW8yDddkINmGp0XVNG2FnCHehVQ_xic&e=>



_______________________________________________

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://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=gwQYJePMwf66Qkf2heyo1UqhkxA31D8XuF0dNsmnvOg&s=DUbP9Ae1PnplwVsabbz8k-6A-ZRz3dLu7e5o5GI9yqU&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://urldefense.proofpoint.com/v2/url?u=http-3A__www.utc.fr_-7Emottelet&d=DwMG-g&c=0hKVUfnuoBozYN8UvxPA-w&r=4TCz--8bXfJhZZvIxJAemAJyz7Vfx78XvgYu3LN7eLo&m=gwQYJePMwf66Qkf2heyo1UqhkxA31D8XuF0dNsmnvOg&s=gdmVN-2pjNdKfA0yL_jVwCc5aMSV0eTSd7Qdt4ClIBo&e=>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20190129/8fbbfd0a/attachment.htm>


More information about the users mailing list