next up previous contents
Next: 7.2 Data manipulation Up: 7. Manipulating and analysing Previous: 7. Manipulating and analysing

   
7.1 Simple data calculations

A common task is the numerical manipulation of a data set, e.g. to add some constant to a data set or inverse all y-values. The command 'ccal' offers a variety of manipulation functions for a specific data set. The command 'kcal' on the other had allows simple arithmetic operations between two data sets. The commands and valid operations are listed in Table 7.1.


 
Table 7.1: Data manipulation functions
Command Operation Description
ccal add Performs xi = xi + a
  exp Performs $x_{i} = \exp (x_{i})$
  inv Performs $x_{i} = \frac {1} {x_{i}}$
  log Performs $x_{i} = \ln (x_{i})$
  mul Performs $x_{i} = f \cdot x_{i}$
  sqr Performs $x_{i} = \sqrt {x_{i}}$
  squ Performs xi = xi2
kcal add Performs x'''i = x''i + x'i
  sub Performs x'''i = x''i - x'i
  mul Performs $x'''_{i} = x''_{i} \cdot x'_{i}$
  div Performs x'''i = x''i / x'i

Note that xi in Table 7.1 stands for x-, y-, z- and $\sigma_{x}$- or $\sigma_{y}$-values depending on the given parameters. The following simple command will multiply all y-values of data set one with the factor 1.75:

     ccal mul,wy,1,1.75

The parameter 'mul' indicates that a multiplication is to be performed using the y-values which are selected by the next parameter ('wy'). Finally data set one and the desired factor of 1.75 are specified. For x- and z-values use 'wx' and 'wz', the standard deviations $\sigma_{x}$ and $\sigma_{y}$ are selected using the parameters 'dx' and 'dy'.

Another feature of KUPLOT is the capability to create a data set from an arithmetic expression rather than reading it from a file. This is done using the command 'func'. The following two commands demonstrate usage of 'func' to create a 1D data set ( $y =
\sin(x))$ and a 2D data set ( $z = \sin(x) \cdot \cos(y))$.

  func sin(r[0]),0.0,6.3,0.1
  func sin(r[0])*cos(r[1]),0,6,0.1,0,6,0.1

Note that the variable 'r[0]' is used for the x-argument and r[1] is used as y-argument. Thus values previously stored in these two variables are destroyed by the 'func' command. The following commands are the range and the grid size in the two directions. In our first example, the desired x-range is $0.0 \rightarrow 6.3$ with a grid size of $\Delta x = 0.1$. This results the creation of a data set with 64 points. The second 'func' command shown above creates a 2D data set ranging from 0.0 to 6.1 in x- and y-direction with a grid size of $\Delta x = \Delta y = 0.1$ given a size of 61x61 data points. Alternatively, space for a new data set can be initialize using the command 'alloc' and the data values are then calculated using the FORTRAN style interpreter of KUPLOT (see section 7.3. However, the creation of large data sets this way from an arithmetic expression might be relatively slow.


next up previous contents
Next: 7.2 Data manipulation Up: 7. Manipulating and analysing Previous: 7. Manipulating and analysing
Thomas Proffen {Billinge}
1999-06-26