namelist - return dataset list

Syntax: string namelist(string foldername)
Description: Return the names of all variables in foldername.
  • If foldername is not specified then the current folder is used.
  • If no datasets can be found - undef is returned
  • The datasets are listed in order of creation
  • namelist("WORK") is the same as childrenof(WORK).
  • all("Dataset", "WORK") is similar but values returned include the folder name.
  • You can use typeof and sizex, sizey, sizez to find the dateset's type and size.
Code sample:

#A version of import_report which returns the names of the datasets read

function string my_import_report(string filename, string filter, string titles)
  float n;  string names;

  n = size(namelist());
  import_report(filename, filter, titles);
  names = namelist();
  return dropx(names, 1:n);

endfunction

See also: childrenof, typeof, sizex

nargs - return number of arguments

Syntax: float nargs()
Description: Reserved function name for use when GSL functions support a variable number of arguments.

nargs currently works, but is of no practical use.

nicerange - return range of values within nicely rounded limits

Syntax: float nicerange(float x, float nx)
Description: Return nx evenly distributed numbers within the nicely rounded limits of x.
  • See the range function for further details
  • The algorithm used for nicely rounding the limits is the same as is used by Gsharp to choose the domain limits.
Code sample:
function float NiceStep(float r)
  float drange, bb, brest, fac;

  drange = log10(r);
  bb = int(drange);  brest = drange-bb;
  if brest < .39794 then     fac=.1;
  elif brest < .69897 then   fac = .25;
  else                       fac = .5;
  endif

  return fac * 10**bb;
endfunction
nicelims = nicerange(x,2);
nicestep = NiceStep(nicelims[2] - nicelims[1]);
See also: range

nint - return nearest integer

Syntax: float nint(float x)
Description: Returns the nearest integer to each element of x
Examples: x nint(x)
-1.5
2
2.5
-1
2
3
See also: int

normprob - probability density function of a normal distribution

Syntax: float normprob(float x)
Description: Return the probability that a normally distributed variable of mean 0.0 and standard deviation 1.0 has a value less than or equal to x.
  • The result is accurate to approximately 4 significant figures
  • To find the probability that a normally distributed variable of mean n and standard deviation d has a value less than or equal to x use:
    normprob((x-n)/d)
Code sample:
x = (-60:60)/20;
y = normprob(x);
create Viewport page_1.viewport_1;
create Domain page_1.viewport_1.domain_1;
create Graph page_1.viewport_1.domain_1.graph_1
   ( XuNgraphType = "line",
     XuNxData = "x",
     XuNyData = "differentiate(y)*20"
   );
See also:

fprob, tprob, x2prob

normrnd - normally distributed random numbers

Syntax: float normrnd(float n)
Description: Return n numbers normally distributed with mean 0 and standard deviation 1.
  • For a distribution with mean m and standard deviation d use:
    normrnd(n)*d + m
See also:

rnd, exprnd

not - logical not

Syntax: float not(float x)
not x
Description: Return the logical inverse of each element of x. If an element is true return false (0), if it is false return true (1).
  • A value is considered to be false if it is zero, true if it is non-zero
Example: x not(x) not x
0
1
2
1
0
0
Code sample:
if not exists(page_1.view) create Viewport page_1.view;
See also::

and, or

 

 

.