.TH GMTMATH l "1 Jan 2004" .SH NAME gmtmath \- Reverse Polish Notation calculator for data tables .SH SYNOPSIS \fBgmtmath\fP [ \fB\-C\fP\fIcols\fP ] [ \fB\-H\fP\fInrec\fP ] [ \fB\-N\fP\fIn_col\fP/\fIt_col\fP ] [ \fB\-Q\fP ] [ \fB\-S\fP ][ \fB\-T\fP\fIt_min/t_max/t_inc\fP ] [ \fB\-V\fP ] [ \fB\-bi\fP[\fBs\fP][\fIn\fP] ] [ \fB\-bo\fP[\fBs\fP][\fIn\fP] ] \fIoperand\fP [ \fIoperand\fP ] \fBOPERATOR\fP [ \fIoperand\fP ] \fBOPERATOR\fP ... \fB=\fP [ \fIoutfile\fP ] .SH DESCRIPTION \fBgmtmath\fP will perform operations like add, subtract, multiply, and divide on one or more table data files or constants using Reverse Polish Notation (RPN) syntax (e.g., Hewlett-Packard calculator-style). Arbitrarily complicated expressions may therefore be evaluated; the final result is written to an output file [or standard output]. When two data tables are on the stack, each element in file A is modified by the corresponding element in file B. However, some operators only require one operand (see below). If no data tables are used in the expression then options \fB\-T, \-N\fP must be set (and optionally \fB\-b\fP). By default, all columns except the "time" column are operated on, but this can be changed (see \fB\-C\fP). .TP \fIoperand\fP If \fIoperand\fP can be opened as a file it will be read as an ASCII (or binary, see \fB\-bi\fP) table data file. If not a file, it is interpreted as a numerical constant or a special symbol (see below). .TP \fIoutfile\fP is a table data file that will hold the final result. If not given then the output is sent to stdout. .TP .B OPERATORS Choose among the following operators: .br Operator n_args Returns .br .sp \fBABS\fP 1 abs (A). .br \fBACOS\fP 1 acos (A). .br \fBACOSH\fP 1 acosh (A). .br \fBADD(+)\fP 2 A + B. .br \fBAND\fP 2 NaN if A and B == NaN, B if A == NaN, else A. .br \fBASIN\fP 1 asin (A). .br \fBASINH\fP 1 asinh (A). .br \fBATAN\fP 1 atan (A). .br \fBATAN2\fP 2 atan2 (A, B). .br \fBATANH\fP 1 atanh (A). .br \fBBEI\fP 1 bei (A). .br \fBBER\fP 1 ber (A). .br \fBCEIL\fP 1 ceil (A) (smallest integer >= A). .br \fBCHIDIST\fP 2 Chi-squared-distribution P(chi2,nu), with chi2 = A and nu = B. .br \fBCOS\fP 1 cos (A) (A in radians). .br \fBCOSD\fP 1 cos (A) (A in degrees). .br \fBCOSH\fP 1 cosh (A). .br \fBD2DT2\fP 1 d^2(A)/dt^2 2nd derivative. .br \fBD2R\fP 1 Converts Degrees to Radians. .br \fBDILOG\fP 1 Dilog (A). .br \fBDIV(/)\fP 2 A / B. .br \fBDDT\fP 1 d(A)/dt 1st derivative. .br \fBDUP\fP 1 Places duplicate of A on the stack. .br \fBERF\fP 1 Error function of A. .br \fBERFC\fP 1 Complementory Error function of A. .br \fBERFINV\fP 1 Inverse error function of A. .br \fBEQ\fP 2 1 if A == B, else 0. .br \fBEXCH\fP 2 Exchanges A and B on the stack. .br \fBEXP\fP 1 exp (A). .br \fBFDIST\fP 4 F-dist Q(var1,var2,nu1,nu2), with var1 = A, var2 = B, nu1 = C, and nu2 = D. .br \fBFLOOR\fP 1 floor (A) (greatest integer <= A). .br \fBFMOD\fP 2 A % B (remainder). .br \fBGE\fP 2 1 if A >= B, else 0. .br \fBGT\fP 2 1 if A > B, else 0. .br \fBHYPOT\fP 2 hypot (A, B). .br \fBI0\fP 1 Modified Bessel function of A (1st kind, order 0). .br \fBI1\fP 1 Modified Bessel function of A (1st kind, order 1). .br \fBIN\fP 2 Modified Bessel function of A (1st kind, order B). .br \fBINT\fP 1 Numerically integrate A. .br \fBINV\fP 1 1 / A. .br \fBISNAN\fP 1 1 if A == NaN, else 0. .br \fBJ0\fP 1 Bessel function of A (1st kind, order 0). .br \fBJ1\fP 1 Bessel function of A (1st kind, order 1). .br \fBJN\fP 2 Bessel function of A (1st kind, order B). .br \fBK0\fP 1 Modified Kelvin function of A (2nd kind, order 0). .br \fBK1\fP 1 Modified Bessel function of A (2nd kind, order 1). .br \fBKN\fP 2 Modified Bessel function of A (2nd kind, order B). .br \fBKEI\fP 1 kei (A). .br \fBKER\fP 1 ker (A). .br \fBLE\fP 2 1 if A <= B, else 0. .br \fBLMSSCL\fP 1 LMS scale estimate (LMS STD) of A. .br \fBLOG\fP 1 log (A) (natural log). .br \fBLOG10\fP 1 log10 (A). .br \fBLOG1P\fP 1 log (1+A) (accurate for small A). .br \fBLOWER\fP 1 The lowest (minimum) value of A. .br \fBLT\fP 2 1 if A < B, else 0. .br \fBMAD\fP 1 Median Absolute Deviation (L1 STD) of A. .br \fBMAX\fP 2 Maximum of A and B. .br \fBMEAN\fP 1 Mean value of A. .br \fBMED\fP 1 Median value of A. .br \fBMIN\fP 2 Minimum of A and B. .br \fBMODE\fP 1 Mode value (LMS) of A. .br \fBMUL(x)\fP 2 A * B. .br \fBNAN\fP 2 NaN if A == B, else A. .br \fBNEG\fP 1 -A. .br \fBNRAND\fP 2 Normal, random values with mean A and std. deviation B. .br \fBOR\fP 2 NaN if A or B == NaN, else A. .br \fBPLM\fP 3 Associated Legendre polynomial P(-1