[Scilab-users] norm() and %inf, %nan

Stéphane Mottelet stephane.mottelet at utc.fr
Fri Jan 25 17:30:24 CET 2019


Hello all,

In Scilab 6.0.1 (and previous versions), norm() does not support %inf 
and %nan in the argument:

--> norm([1 %inf])

norm: Wrong value for argument #1: Must not contain NaN or Inf.

--> norm([1 %nan])

norm: Wrong value for argument #1: Must not contain NaN or Inf.

We plan to change this in Scilab 6.0.2, i.e. returning a value instead 
of raising based on the following rationale:
since, at least for vectors, we have for finite p

norm(x,p)=sum(abs(x).^p)^(1/p)

we should have, for example,

-%inf case:

--> p=2;x=[1 %inf]; sum(abs(x).^p)^(1/p)
  ans  =

    Inf

-%nan case:

--> p=2;x=[1 %nan]; sum(abs(x).^p)^(1/p)
  ans  =

    Nan

-%inf and %nan case

--> p=2;x=[1 %nan %inf]; sum(abs(x).^p)^(1/p)
  ans  =

    Nan

hence,

norm([1 %inf],p) -> %inf,

norm([1 %nan],p) -> %nan

norm([1 %nan %inf],p) -> %nan

Thank you for your feedback !

S.


-- 
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




More information about the users mailing list