Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.atnf.csiro.au/computing/software/gipsy/hermes/numbers.html
Дата изменения: Unknown
Дата индексирования: Fri Jan 16 23:07:06 2009
Кодировка:

Поисковые слова: sts-64
Number input

Number input


This document describes how number input can be given to tasks which request numbers from Hermes. Please note that a task can also obtain its input in character form and do its own decoding. In such cases the features described below may not (all) be available. An example of this is the input of positions.

Overview

Number input can be given as numbers and/or expressions. In expressions the following elements can be used: operators, numbers, constants, variables and functions.

A list of numbers can be specified as a sequence separated by blanks and/or using the `start:end:increment' notation, where the `:increment' part is optional and defaults to one. A list of n identical values can be specified as `value::n'.

A list can also be used as an operand in an expression. In this case the list must be enclosed by square brackets [ ] or parentheses ( ). The expression is then evaluated for each element of the list.

The operator ? can be used to select one or more items from a list. See example below.

Examples:

1 2 3/3  sin(pi)      yields       1.0 2.0 1.0 0.0
log(10)::4            yields       1.0 1.0 1.0 1.0
log(10):log(100):2/4  yields       1.0 1.5 2.0
10**[0 1 5]           yields       1 10 100000
[1:3]+[90:70:-10]     yields       91 82 73
[20:30]?[3 4 5]       yields       22 23 24
Suppose an inclination at keyword INCL= must be given in degrees, but you want to give the input in axis ratio.
INCL= deg(acos(0.3 0.5))
The argument for acos is a list consisting of the elements 0.3 and 0.5. The expression evaluates these two values for acos and converts the resulting values to degrees. In this way the values 0.3 and 0.5 are converted to the angles 72.5424 and 60.0 degrees.

Numbers

Numbers can be specified as integers, using fixed point notation or using E or D format. Internally all numbers are represented as double precision floating point numbers.

Examples:

  123
  123.45
  1234.5E-2
  .12345D3

Operators

The following operators are known:
   +          addition
   -          subtraction
   *          multiplication
   /          division
   **         exponentition
   ?          list selection          

Constants

The following constants are implemented:
   pi         3.14159....
   c          speed of light (SI)
   h          Planck (SI)
   k          Boltzmann (SI)
   g          gravitation (SI)
   s          Stefan-Boltzman (SI)
   m          mass of sun (SI)
   p          parsec (SI)
   BLANK      Universal undefined value

Mathematical functions

The following mathematical functions are implemented:
   abs(x)     absolute value of x
   sqrt(x)    square root of x
   sin(x)     sine of x
   asin(x)    inverse sine of x
   cos(x)     cosine of x
   acos(x)    inverse cosine of x
   tan(x)     tangent of x
   atan(x)    inverse tan of x
   exp(x)     exponential of x
   sinh(x)    hyperbolic sine of x
   ln(x)      natural log of x
   cosh(x)    hyperbolic cosine of x
   log(x)     log (base 10) of x
   tanh(x)    hyperbolic tangent of x
   rad(x)     convert x to radians
   deg(x)     convert x to degrees
   erf(x)     error function of x
   erfc(x)    1-error function
   max(x,y)   maximum of x and y
   min(x,y)   minimum of x and y
   sinc(x)    sin(x)/x
   atan2(x,y) inverse tan (mod 2pi); x = sin, y = cos 
   sign(x)    sign of x (-1,0,1)
   mod(x,y)   remainder of x/y
   int(x)     truncates to integer 
   nint(x)    nearest integer
   ranu(x,y)  generates uniform noise between x and y
   rang(x,y)  generates gaussian noise with mean x and dispersion y  
   ranp(x)    generates poisson noise with mean x

  ifeq(x,y,a,b)   a if x equal y, else b
  ifne(x,y,a,b)   a if x not equal y, else b
  ifgt(x,y,a,b)   a if x greater y, else b
  ifge(x,y,a,b)   a if x greater or equal y, else b   
  iflt(x,y,a,b)   a if x less y, else b
  ifle(x,y,a,b)   a if x less or equal y, else b

Database- and file functions

The following functions can be used to obtain data from GIPSY-sets and files:
  descr(set, name)
        descriptor item `name' from (sub)set(s) `set'.
  table(set, tab, col, rows)
        cell(s) from column `col' of table `tab' in (sub)set `set'.
  image(set, box)
        pixel(s) from (sub)set `set'.
  file(name, col, rows)
        number(s) from a column in a text file.
        Comments can be prefixed by the character ! or #.
The syntax of the set- and box arguments is described in a separate document.
The argument `rows' has the following syntax:
:use the whole file;
n:m use line numbers n to m;
:nuse line numbers 1 to n;
n:use line numbers n to the end of the file;
nuse only line number n.

This is the same syntax as used for recall files. See also the examples below.

Examples
descr(aurora freq 10, noise)
yields the value of (FITS-) descriptor item ``NOISE''.

image(aurora freq 10, -5 -5 5 5 )
yields a list with the central 121 pixel values of set ``aurora'' at FREQ=10.

table(aurora p 2, ROTCUR03, VROT, 1:20)
yields 20 values from column ``VROT'' in table ``ROTCUR03'' from set ``aurora'' at PARAM=2.

table(aurora p 2, ROTCUR03, VROT, :)
like previous example, but all values from the column are returned.

file(rotcur03.dat, 4, 1:20)
yields 20 values from column 4 in ASCII file rotcur03.dat.

List functions

The following functions can be used on lists:
  count(x)  number of elements in x
  mean(x)   the average of the elements in x
  sum(x)    the sum of the elements in x

Variables

Hermes supports named variables. To these variables numbers and lists of numbers can be assigned. Variable names can be up to 20 characters long; they are not case-sensitive. The maximum number of variables is 40. A variable can be deleted by assigning the value BLANK to it. Assignment to a variable is accomplished by issuing a special Hermes command:
variable= value
or, in tHermes, doing the assignment in the tHermes calculator window.
Hermes GIPSY