Next: transpose() Up: MacAnova Help File Previous: trace()   Contents

# transformations

Usage:
 ```List of available transformations. Argument x is REAL or structure with REAL components. 't' => behavior depends on option 'angles'. '2' => has two argument variant. Transformation Result for REAL scalar x abs(x) |x| = absolute value of x acos(x) t arccosine of x asin(x) t arcsine of x atan(x) t 2 arctangent of x atanh(x) inverse hyperbolic tangent of x ceiling(x) least integer >= x cos(x) t cosine of x cosh(x) hyperbolic cosine of x digamma(x) digamma(x) = (d/dx)log(gamma(x)) exp(x) exp(x) = exponential function of x floor(x) greatest integer <= x lgamma(x) ln(gamma(x)) = log gamma function of x log(x) ln(x) = base-e log(x) = natural logarithm of x log10(x) base-10 log(x) = common log of x log2(x) base-2 log(x) = log(x)/log(2) polygamma(x) 2 digamma(x) and (d/dx)^n digamma(x) round(x) 2 nearest integer to x sin(x) t sine of x sinh(x) hyperbolic sine of x sqrt(x) square root of x tan(x) t tangent of x tanh(x) hyperbolic tangent of x ```

Keywords: transformations
```Transformation are abs(x), acos(x), asin(x), atan(x) or atan(x,y),
atanh(x), ceiling(x), cos(x), cosh(x), digamma(x), exp(x), floor(x),
lgamma(x), log(x), log10(x), log2(x), polygamma(x) or polygamma(x,n),
round(x) or round(n,ndec), sin(x), sinh(x), sqrt(x), tan(x) and tanh(x)
where x (and y) are REAL variables or structures with REAL components.
x can also be a CHARACTER variable (see below).

Type usage(transformations) for one line descriptions of what these
transformations compute.  Type help(tranName), for example help(cos) or
help(sqrt), for help on individual transformations.

Trigonometric functions and their inverses are affected by the value of
option 'angles'.  See below and subtopic 'options:"angles"'.

When x is a REAL vector, matrix or array, the result is REAL with the
same size and shape, with the elements of the result the transformations
of the elements of x.  For example, if x is a matrix, exp(x)[i,j] is
exp(x[i,j]).

When x is a structure, the result is a structure of the same shape and
with the same component names as x, whose components are the transformed
components of the argument.  See topic 'structures'.

When any element of x is MISSING or outside the range of validity for
the function (for instance, < 0 for sqrt()), the corresponding element
of the result is MISSING and a warning message is printed.  See below
for more details.

When x or any components have labels, the result has the same labels.
See topic 'labels'.

Trignometric Functions
For sin(), cos() and tan(), the elements of x are interpreted as being
in radians, cycles or degrees according to the value of option 'angles'
whose default value is "radians".  Similarly, the values returned by
asin(), acos() and atan() are in the units specified by option 'angles'.
You can change the default by setoptions(angles:"degrees") or
setoptions(angles:"cycles").  See topic setoptions(), subtopic
'options:"angles"'.

All the trigonometric functions also allow one of 'degrees:T',
'cycles:T' and 'radians:T' as an extra argument.  These override the
units specified by option 'angles'.  For example, sin(30, degrees:T)
always returns 0.5 and asin(0.5, degrees:T) always returns 30.

Illegal or too large arguments
When the argument to a function is illegal (for example, sqrt(-1) or
atanh(1.2)), a warning message is printed and the result is set to
MISSING.

When the value of a function is too large to be represented in the
computer (for example, sinh(-3000)), a message is printed and the result
is set to MISSING.

Because of significant loss of precision in computing trigonmetric
functions of a large argument, the result of sin(x), cos(x) or tan(x) is
MISSING when |x| >= 5000000*PI radians (= 2500000 cycles = 900000000
degrees) and a warning message is printed.

When x > 4503599627370495 or x < -4503599627370495, floor(x) and
ceiling(x) are set to MISSING because of the impossibility of exact
representation of integers beyond these limits.  These limits may be
different on some computers.

CHARACTER argument
When the argument x to a transformation is a CHARACTER variable, the
result is a CHARACTER variable of the same size and shape with elements
usually involving the transformation name and the elements of x.  Any
element of x that is "" or starts with '@', '(', '[', '{', '<', '/' or
'\' is not modified.  This also works with two argument transformations
such as atan(x,y) and round(x,p), as long as both arguments are
CHARACTER.  This feature can be useful in creating labels for
transformed data.

Examples:
Cmd> logx <- matrix(log(x),labels:structure(getlabels(x,1),\
log(getlabels(x,2))))

This uses the row labels of x and transforms the column labels of x.

Cmd> w <- log(vector("X", "Y", "", "@[", "(1)"))

w will be vector("log(X)","log(Y)","","@[","(1)")