Gri: Mathematics

Chapters: 1: Introduction 2: Simple example 3: Invocation 4: Finer Control 5: X-Y Plots 6: Contour Plots 7: Image Plots 8: Examples 9: Gri Commands 10: Programming 11: Environment 12: Emacs Mode 13: History 14: Installation 15: Gri Bugs 16: Test Suite 17: Gri in Press 18: Acknowledgments 19: License Indices: Concepts Commands Variables | ## 10.8: Mathematics Gri lets you do some simple mathematical manipulations on your column and grid data. ### 10.8.1: Column data The column operators are ``=`', ``+=`', ``-=`', ``*=`', ``/=`', ``^=`' (exponentiation) and ``_=`' (logarithm). There must be spaces before and after the operators, but no space between the 2 letters of the operators. The operations may be applied not only to ``x`' and ``y`' as shown, but also to ``z`' (used to hold data to be contoured or written as symbols), and ``u`' and ``v`' (used to store vector fields). The axis scales are not changed by mathematical operations on the columns, regardless of whether the scales were set manually or by Gri command (see Axis Scaling). Elements of columns are available by the ``@`' reverse polish operator (see rpn Mathematics). Examples: To multiply all the x data by 10, use ``x *= 10`'; to add 5 to each y-value, use ``y += 5`'. To set all the y data to 10, do ``y = 10`'. (This will only work if you've already read column data.) See also see Tertiary Operators for a method of assigning or altering column data using the RPN operator. ### 10.8.2: Grid data Various commands let you alter grid data as used in contouring (see Contour Plots). Possible commands are as follows.
    grid data = number
    grid data += number
    grid data -= number
    grid data *= number
    grid data /= number
    grid data ^= number # take data to power 'number'
    grid data _= number # take log base 'number'
    grid x = number
    grid x += number
    #... others as in `grid data'
    grid y = number
    grid y += number
    #... others as in `grid data'
#### 10.8.2.1: Image data Various commands let you alter image data (see Images.). Possible commands are as follows.
    image += number
    image -= number
    image *= number
    image /= number
    image ^= number # power
    image _= number # logarithm
#### 10.8.2.2: Image grayscale/colorscale Various commands let you alter image data (see Images). Possible commands are as follows.
    image grayscale += number
    image grayscale  -= number
    image grayscale  *= number
    image grayscale  /= number
    image grayscale  ^= number # power
    image grayscale  _= number # logarithm
    image colorscale += number
    image colorscale  -= number
    image colorscale  *= number
    image colorscale  /= number
    image colorscale  ^= number # power
    image colorscale  _= number # logarithm
#### 10.8.2.3: Variables Possible commands are:
    .variable. = number
    .variable. += number
    .variable. -= number
    .variable. *= number
    .variable. /= number
    .variable. ^= number # power
    .variable. _= number # logarithm