Arithmetic operations with data columns


There are various ways to perform arithmetic operations with data columns.
Such operations are specified in the respective header line (H:).

1. Arithmetic Operations with Constants

   H: Y(Data),L2+200      add 200 to the y-values
   H: X/5                 divide the x-values by 5
   H: Y*10                multiply the y-values by 10
   H: D+-/5               divide the error values by 5
   H: Y**-2*3.5+37.7
   H: (D%=5)              assign constant error values of 5%

2. Arithmetic Operations with Vectors

   Operations with constants can be combined with operations between data columns:

   H:  X**2-N1   Y1*Y2*.01+1(exp),LT11    D*Y2,T    Y2+X+N1,L0  N1

   In this example the data are processed in two steps,
   first the data are read as if you had specified the header line:

   H:  X          Y1,LT11                  D,T       Y2,L0       N1

   for display the columns are modified as:

       X'=X**2-N1 Y1'=Y1*Y2*.01+1          D'=D*Y2   Y2'=Y2+X+N1 N1'=N1


   Data column types X, Y, S, B, A, M, D, N are allowed as operands.
   For the operations the original data are used.

3. Arithmetic Operations for implicit loops 

   Linear operations with constants can be performed in implicit loops
   in 1- or 2-dimensional header lines:

      H:  (X=1 TO 128 BY 0.5)*3.7 Y,L3
      H2: (X=1 TO 100 BY 1)-0.35*7.2 (Y= 0 TO 20 BY 0.1)*-5

   Data column types X, Y, S, B, A, M, D, N are allowed as operands.
   For the operations the original data are used.

4. Combinations of Data Columns 

   Immediate addition or multiplication between the values of different data
   columns may be performed with the column types A and M.

   A specifies a column of y-values which is added to the A-, M- or Y-column to the left.
     A-columns are otherwise treated the same way as Y-columns.
     You use A*-1 to subtract data.
     Example:

     H:  X  Y1 A1 Y2   A2*-1
         1  10 10 100 100
         2  20 10 200 100

     The first A-column is plotted as y=20 and y=30, the second one as y=0 and y=100.

   M specifies a column of y-values which is multiplied with the A-, M- or Y-column to the left.
     M-columns are otherwise treated the same way as Y-columns.
     You use M**-1 to divide data.
     Example:

     H:  X  Y1 M1 Y2  M2**-1
         1  10 10 100 100
         2  20 10 200 100

     The first M-column is plotted as y=100 and y=200, the second one as y=1 and y=2.

   For operations with A and M columns the data after operations with constants and vectors are used.

5. Polynomials with Columns

   A special syntax to evaluate polynomials using other data columns as arguments is provided:

   H:  X      Y1      (Y=POL(Y1;100,10,1;LIN))
   H:  X      Y1      (Y=POL(Y1;100,10,1;LOG))
   H:  X      Y1      (Y=POL(Y1;100,10,1;XLOG,YLIN))
       x-data y1-data
       ...    ...

   will result in an Y=column evaluated as

      Y=(Y1*1+10)*Y1+100

   The LOG modifiers cause the argument values to be log10()'ed
   before the operation and the result values to be 10**()'ed before display.

6. Arithmetic Expressions with Columns

   Arbitray arithmetic expressions may be specified enclosed in parantheses:

      H: (y=10*sin(x/5)),lt0   x/10   (y2=10*cos(y/5)),lgt0
      1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

   This example defines data only for a single X column divided by 10 to obtain
   the angular range 0..PI. Two Y-columns are derived as a function of X
   and Y, respectively.
   Note that all columns must have unique header identifiers, i.e.
   multiple Y-columns must be specified as Y1, Y2, Y3, ... .
   For the operations the original data are used.

   Remark
   In contrast to the original satangd program
   the operations are performed according to usual mathematical and programming conventions:

   X-3*5 means X-15

   X*5-15 means (X-3)*5

   To achieve ((X-3)**0.5)*(-5)/Y2 you have write a line like this:

   h: x      y2,l2   (y1=((x-3)**0.5)*(-5)/y2),l1
      x-data y2-data 
      ...    ...


7. Function Plotting

   The syntax of arithmetic expressions allows to plot simple functions,
   i.e. define data blocks without data:

   H: (x=0 to 10 by 1) (y=sqrt(x))

   will plot the square root function.
   More complex expressions are possible too:

   H: (n=0 to 180) (x=cos(n/180*22/7)*2) (y1=(x**2)**(1/3)+sqrt(4-x**2)),lt0 (y2=(x**2)**(1/3)-sqrt(4-x**2)),lt0

   Try plot it yourself.

   Supported functions are :
   sin(), cos(), tan(), asin(), acos(), atan(), sinh(), cosh(), tanh(),
   exp(), log(), log10(), log2(), sqrt(), abs(), neg().