[Scilab-users] display of complex/not real numbers, again

Stéphane Mottelet stephane.mottelet at utc.fr
Fri Sep 13 14:22:35 CEST 2019


However, as I already said it elsewhere, some glitches such as the 
following  one do occur (see the display of whole x)

--> x=1:0.1:2
  x  =

    1.   1.1   1.2   1.3   1.4   1.5   1.6   1.7000000   1.8 1.9   2.

--> x(7)
  ans  =

    1.6

--> x(7)-1.6
  ans  =

    0.

--> x(8)

  ans  =

    1.7000000

--> x(8)-1.7
  ans  =

    2.220D-16

I think that we do agree about the fact that the actual Scilab display

--> x=1:0.1:2
  x  =

    1.   1.1   1.2   1.3   1.4   1.5   1.6   1.7  1.8   1.9   2.

--> x(7)
  ans  =

    1.6

--> x(7)-1.6
  ans  =

    0.

--> x(8)
  ans  =

    1.7

--> x(8)-1.7
  ans  =

    2.220D-16

is pretty but not correct/homogeneous/honest. The display that is 
obtained with the patch (first lines of this email) is correct+honest 
but not homogeneous. A pretty + mathematically correct display would be:

--> x=1:0.1:2
  x  =

    1.0000000   1.1000000   1.2000000   1.3000000   1.4000000 
1.0000005   1.6000000   1.7000000   1.8000000   1.9000000 2.0000000

--> x(7)
  ans  =

    1.6

--> x(8)
  ans  =

    1.7000000

--> x(8)-1.7

  ans  =

    2.220D-16

i.e. when the matrix to display is not a scalar, add always trailing 
zeros for homogeneity, BUT when it is a scalar, add trailing zeros only 
when the actual stored value is different from the displayed value.

The first thing that you can see is that the default format(10) would be 
very verbose, but this is tunable. A value of 7 would be ok, but quite 
low for format("e").

S.

Le 13/09/2019 à 13:37, Stéphane Mottelet a écrit :
>
>
> Le 13/09/2019 à 13:07, Samuel Gougeon a écrit :
>> Le 12/09/2019 à 18:55, Stéphane Mottelet a écrit :
>>> I prefer the display after applying 
>>> https://codereview.scilab.org/#/c/20981/:
>>>
>>> --> x0=%pi/4;h=%eps/2
>>>  h  =
>>>
>>>    1.110D-16
>>>
>>> --> cos(x0+%i*h)
>>>  ans  =
>>>
>>>    0.7071068 - 7.850D-17i
>>>
>>> However, we could discuss if the arbitrary switch to "e" mode is 
>>> desirable or not, but since Scilab 6.0 we have got used to this 
>>> display mixing "v" and "e" mode...
>>
>>
>> ... and IMO it's very suitable. The only rule should be that, */for a 
>> given format's width/*, */the more the number of significant 
>> displayed figures the better./* When the exponent format is used, it 
>> takes 4 or 5 digits (D+12, D+123). As a consequence, in v mode, small 
>> (absolute) values should be displayed in normal mode down to 4 
>> non-significant 0 (e.g. 0.000012), and switched to "e" mode beyond.
>>
>> In v mode, forcing the display of 0.0123456  in "e" mode on the (bad) 
>> reason that some other huge or tiny numbers in the matrix are 
>> displayed in this mode, would print 1.234D-02, and so make invisible 
>> 2 significant figures.
>> I do not see any reason that would impose the display mode to be 
>> homogeneous over all elements of a matrix, possibly canceling the 
>> display of significant figures in the given format's width.
>>
> I agree Samuel.
>>
>> Regards
>>
>> Samuel
>>
>>
>>
>> _______________________________________________
>> 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
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20190913/cfe125d1/attachment.htm>


More information about the users mailing list