Axes_names

REDUC
E

INDEX

AXES NAMES

Inside REDUCE the choice of variable names for a graph is completely free. For referring to the GNUPLOT axes the names X and Y for 2 dimensions, X,Y and Z for 3 dimensions are used in the usual schoolbook sense independent from the variables of the REDUCE expression.

examples:

Pointset

REDUC
E

INDEX

POINTSET _ _ _ _ _ _ _ _ _ _ _ _ type

A curve can be give as a set of precomputed points (a polygon) in 2 or 3 dimensions. Such a point set is a list of points, where each point is a list 2 (or 3) numbers. These numbers are interpreted as (x,y) (or x,y,z) coordinates. All points of one set must have the same dimension.

examples:

Also a surface in 3d can be given by precomputed point s, but only on a logically orthogonal mesh: the surface is defined by a list of curves (in 3d) which must have a uniform length. GNUPLOT then will draw an orthogonal mesh by first drawing the given lines, and second connecting the 1st point of the 1st curve with the 1st point of the 2nd curve, that one with the 1st point of the 3rd curve and so on for all curves and for all indexes.

PLOT

REDUC
E

INDEX

PLOT _ _ _ _ _ _ _ _ _ _ _ _ command

The command plot is the main entry for drawing a picture from inside REDUCE.

syntax:

plot(<spec>,<spec>,...)

where <spec> is a <function>, a <range> or an <option>.

<function>:

- an expression depending on one unknown (e.g. sin(x) or two unknowns (e.g. sin(x+y),

- an equation with a function on its right-hand side and a single name on its left-hand side (e.g. z=sin(x+y) where the name on the left-hand side specifies the dependent variable.

- a list of functions: if in 2 dimensions the picture should have more than one curve the expressions can be given as list (e.g. {sin(x),cos(x)}).

- an equation with zero left or right hand side describing an implicit curve in two dimensions (e.g. x**3+x*y**3-9x=0).

- a point set: the graph can be given as point set in 2 dimensions or a pointset or pointset list in 3 dimensions.

<range>:

Each dependent and independent variable can be limited to an interval by an equation where the left-hand side specifies the variable and the right-hand side defines the interval, e.g. x=( -3 .. 5).

If omitted the independent variables range from -10 to 10 and the dependent variable is limited only by the precision of the IEEE floating point arithmetic.

<option>:

An option can be an equation equating a variable and a value (in general a string), or a keyword(GNUPLOT switch). These have to be included in the gnuplot command arguments directly. Strings have to be enclosed in string quotes (see string). Available options are:

title: assign a heading (default: empty)

xlabel: set label for the x axis

ylabel: set label for the y axis

zlabel: set label for the z axis

terminal: select an output device

size: rescale the picture

view: set a viewpoint

(no) contour: 3d: add contour lines

(no) surface: 3d: draw surface (default: yes)

(no) hidden3d: 3d: remove hidden lines (default: n o)

examples:


plot(cos x);

plot(s=sin phi,phi=(-3 .. 3));

plot(sin phi,cos phi,phi=(-3 .. 3));

plot (cos sqrt(x**2 + y**2),x=(-3 .. 3),y=(-3 .. 3),hidden3d);

plot {{0,0},{0,1},{1,1},{0,0},{1,0},{0,1},{0.5,1.5},{1,1},{1,0}};



on rounded;

w:=for j:=1:200 collect {1/j*sin j,1/j*cos j,j/200}$

plot w; 

Additional control of the plot operation: plotrefine, plot_xmesh, plot_ymesh, trplot, plotkeep, show_grid.

PLOTRESET

REDUC
E

INDEX

PLOTRESET _ _ _ _ _ _ _ _ _ _ _ _ command

The command plotreset closes the current GNUPLOT windows. The next call to plot will create a new one. plotreset can also be used to reset the system status after technical problems.

syntax:

plotreset;

title

REDUC
E

INDEX

TITLE _ _ _ _ _ _ _ _ _ _ _ _ variable

plotoption: Assign a title to the GNUPLOT graph.

syntax:

title= <string>

examples:


title="annual revenue in 1993"

xlabel

REDUC
E

INDEX

XLABEL _ _ _ _ _ _ _ _ _ _ _ _ variable

plotoption: Assign a name to to the x axis (see axes names).

syntax:

xlabel= <string>

examples:


xlabel="month"

ylabel

REDUC
E

INDEX

YLABEL _ _ _ _ _ _ _ _ _ _ _ _ variable

plotoption: Assign a name to to the x axis (see axes names).

syntax:

ylabel= <string>

examples:


ylabel="million forint"

zlabel

REDUC
E

INDEX

ZLABEL _ _ _ _ _ _ _ _ _ _ _ _ variable

plotoption: Assign a name to to the z axis (see axes names).

syntax:

zlabel= <string>

examples:


zlabel="local weight"

terminal

REDUC
E

INDEX

TERMINAL _ _ _ _ _ _ _ _ _ _ _ _ variable

plotoption: Select a different output device. The possible values here depend highly on the facilities installed for your GNUPLOT software.

syntax:

terminal= <string>

examples:


terminal="x11"

size

REDUC
E

INDEX

SIZE _ _ _ _ _ _ _ _ _ _ _ _ variable

plotoption: Rescale the graph (not the window!) in x and y direction. Default is 1.0 (no rescaling).

syntax:

size= "<sx>,<sy>"

where <sx>,<sy> are floating point number not too far from 1.0.

examples:


size="0.7,1"

view

REDUC
E

INDEX

VIEW _ _ _ _ _ _ _ _ _ _ _ _ variable

plotoption: Set a new viewpoint by turning the object around the x and then around the z axis (see axes names).

syntax:

view= "<sx>,<sz>"

where <sx>,<sz> are floating point number representing angles in degrees.

examples:


view="30,130"

contour

REDUC
E

INDEX

CONTOUR _ _ _ _ _ _ _ _ _ _ _ _ switch

plotoption: If contour is member of the options for a 3d plot contour lines are projected to the z=0 plane (see axes names). The absence of contour lines can be selected explicitly by including nocontour. Default is nocontour.

surface

REDUC
E

INDEX

SURFACE _ _ _ _ _ _ _ _ _ _ _ _ switch

plotoption: If surface is member of the options for a 3d plot the surface is drawn. The absence of the surface plotting can be selected by including nosurface, e.g. if only the contour should be visualized. Default is surface.

hidden3d

REDUC
E

INDEX

HIDDEN3D _ _ _ _ _ _ _ _ _ _ _ _ switch

plotoption: If hidden3d is member of the options for a 3d plot hidden lines are removed from the picture. Otherwise a surface is drawn as transparent object. Default is nohidden3d. Selecting hidden3d increases the computing time substantially.

PLOTKEEP

REDUC
E

INDEX

PLOTKEEP _ _ _ _ _ _ _ _ _ _ _ _ switch

Normally all intermediate data sets are deleted after terminating a plot session. If the switch plotkeep is set on, the data sets are kept for eventual post processing independent of REDUCE.

PLOTREFINE

REDUC
E

INDEX

PLOTREFINE _ _ _ _ _ _ _ _ _ _ _ _ switch

In general plot tries to generate smooth pictures by eva luating the functions at interior points until the distances are fine enough. This can require a lot of computing time if the single function evaluation is expensive. The refinement is controlled by the switch plotrefine which is on by default. When you turn it off the functions will be evaluated only at the basic points (see plot_xmesh, plot_ymesh).

plot_xmesh

REDUC
E

INDEX

PLOT_XMESH _ _ _ _ _ _ _ _ _ _ _ _ variable

The integer value of the global variable plot_xmesh defines the number of initial function evaluations in x direction (see axes names) for plot. For 2d graphs additional points will be used as long as plotrefine is on. For 3d graphs this number defines also the number of mesh lines orthogonal to the x axis.

plot_ymesh

REDUC
E

INDEX

PLOT_YMESH _ _ _ _ _ _ _ _ _ _ _ _ variable

The integer value of the global variable plot_ymesh defines for 3d plot calls the number of function evaluations in y direction (see axes names) and the number of mesh lines orthogonal to the y axis.

SHOW_GRID

REDUC
E

INDEX

SHOW_GRID _ _ _ _ _ _ _ _ _ _ _ _ switch

The grid for localizing an implicitly defined curve in plot consists of triangles. These are computed initially equally distributed over the x-y plane controlled by plot_xmesh. The grid is refined adaptively in several levels. The final grid can be visualized by setting on the switch show_grid.

TRPLOT

REDUC
E

INDEX

TRPLOT _ _ _ _ _ _ _ _ _ _ _ _ switch

In general the interaction between REDUCE and GNUPLOT is performed as silently as possible. However, sometimes it might be useful to see the GNUPLOT commands generated by REDUCE, e.g. for a postprocessing of generated data sets independent of REDUCE. When the switch trplot is set on all GNUPLOT commands will be printed to the standard output additionally.

Gnuplot package

REDUC
E

INDEX

Gnuplot package

  • GNUPLOT and REDUCE introduction

  • Axes names concept

  • Pointset type

  • PLOT command

  • PLOTRESET command

  • title variable

  • xlabel variable

  • ylabel variable

  • zlabel variable

  • terminal variable

  • size variable

  • view variable

  • contour switch

  • surface switch

  • hidden3d switch

  • PLOTKEEP switch

  • PLOTREFINE switch

  • plot_xmesh variable

  • plot_ymesh variable

  • SHOW_GRID switch

  • TRPLOT switch

  • Linear_Algebra_package

    REDUC
E

    INDEX

    LINEAR ALGEBRA PACKAGE _ _ _ _ _ _ _ _ _ _ _ _ introduction

    This section briefly describes what's available in the Linear Algebra package.

    Note on examples: In the examples throughout this document, the matrix A will be

    
         [1  2  3]
         [4  5  6]
         [7  8  9].
    

    The functions can be divided into four categories:

    Basic matrix handling

    add_columns,

    add_rows,

    add_to_columns,

    add_to_rows,

    augment_columns,

    char_poly,

    column_dim,

    copy_into,

    diagonal,

    extend,

    find_companion,

    get_columns,

    get_rows,

    hermitian_tp,

    matrix_augment,

    matrix_stack,

    minor,

    mult_columns,

    mult_rows,

    pivot,

    remove_columns,

    remove_rows,

    row_dim,

    rows_pivot,

    stack_rows,

    sub_matrix,

    swap_columns,

    swap_entries,

    swap_rows.

    Constructors -- functions that create matrices

    band_matrix,

    block_matrix,

    char_matrix,

    coeff_matrix,

    companion,

    hessian,

    hilbert,

    jacobian,

    jordan_block,

    make_identity,

    random_matrix,

    toeplitz,

    vandermonde.

    High level algorithms

    char_poly,

    cholesky,

    gram_schmidt,

    lu_decom,

    pseudo_inverse,

    simplex,

    svd.

    Normal Forms

    There is a separate package, NORMFORM, for computing the following matrix normal forms in REDUCE:

    smithex,

    smithex_int,

    frobenius,

    ratjordan,

    jordansymbolic,

    jordan.

    Predicates

    matrixp,

    squarep,

    symmetricp.

    fast_la

    REDUC
E

    INDEX

    FAST_LA _ _ _ _ _ _ _ _ _ _ _ _ switch

    By turning the fast_la switch on, the speed of the following functions will be increased:

    add_columns,

    add_rows,

    augment_columns,

    column_dim,

    copy_into,

    make_identity,

    matrix_augment,

    matrix_stack,

    minor,

    mult_columns,

    mult_rows,

    pivot,

    remove_columns,

    remove_rows,

    rows_pivot,

    squarep,

    stack_rows,

    sub_matrix,

    swap_columns,

    swap_entries,

    swap_rows,

    symmetricp.

    The increase in speed will be negligible unless you are making a significant number (i.e. thousands) of calls. When using this switch, error checking is minimized. This means that illegal input may give strange error messages. Beware.

    add_columns

    REDUC
E

    INDEX

    ADD_COLUMNS _ _ _ _ _ _ _ _ _ _ _ _ operator

    Add columns, add rows:

    syntax:

    add_columns(<matrix>,<c1>,<c2>,<expr>)

    <matrix> :- a matrix.

    <c1>,<c2> :- positive integers.

    <expr> :- a scalar expression.

    The Operator add_columns replaces column <\meta{c2>} of <matrix> by <expr> * column(<matrix>,<c1>) + column(<matrix>,<c2>).

    add_rowsperforms the equivalent task on the rows of <matrix>.

    examples:

    
    
    add_columns(A,1,2,x); 
    
      [1   x + 2   3]
      [             ]
      [4  4*x + 5  6]
      [             ]
      [7  7*x + 8  9]
    
    
    
    add_rows(A,2,3,5); 
    
      [1   2   3 ]
      [          ]
      [4   5   6 ]
      [          ]
      [27  33  39]
    
    

    Related functions: add_to_columns, add_to_rows, mult_columns, mult_rows.

    add_rows

    REDUC
E

    INDEX

    ADD_ROWS _ _ _ _ _ _ _ _ _ _ _ _ operator

    see: add_columns.

    add_to_columns

    REDUC
E

    INDEX

    ADD_TO_COLUMNS _ _ _ _ _ _ _ _ _ _ _ _ operator

    Add to columns, add to rows:

    syntax:

    add_to_columns(<matrix>,<column\_list>,<expr>)

    <matrix> :- a matrix.

    <column\_list> :- a positive integer or a list of positive integers.

    <expr> :- a scalar expression.

    add_to_columnsadds <expr> to each column specified in <column\_list> of <matrix>.

    add_to_rowsperforms the equivalent task on the rows of <matrix>.

    examples:

    
    
    add_to_columns(A,{1,2},10); 
    
      [11  12  3]
      [         ]
      [14  15  6]
      [         ]
      [17  18  9]
    
    
    
    add_to_rows(A,2,-x) 
    
       
      [   1         2         3    ]
      [                            ]
      [ - x + 4   - x + 5   - x + 6]
      [                            ]
      [   7         8         9    ]
    
    

    Related functions: add_columns, add_rows, mult_rows, mult_columns.

    add_to_rows

    REDUC
E

    INDEX

    ADD_TO_ROWS _ _ _ _ _ _ _ _ _ _ _ _ operator

    see: add_to_columns.

    augment_columns

    REDUC
E

    INDEX

    AUGMENT_COLUMNS _ _ _ _ _ _ _ _ _ _ _ _ operator

    Augment columns, stack rows:

    syntax:

    augment_columns(<matrix>,<column\_list>)

    <matrix> :- a matrix.

    <column\_list> :- either a positive integer or a list of positive integers.

    augment_columnsgets hold of the columns of <matrix> specified in column_list and sticks them together.

    stack_rowsperforms the same task on rows of <matrix>.

    examples:

    
    
    augment_columns(A,{1,2}) 
    
       
      [1  2]
      [    ]
      [4  5]
      [    ]
      [7  8]
    
    
    
    stack_rows(A,{1,3}) 
    
      [1  2  3]
      [       ]
      [7  8  9]
    
    

    Related functions: get_columns, get_rows, sub_matrix.

    band_matrix

    REDUC
E

    INDEX

    BAND_MATRIX _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    band_matrix(<expr\_list>,<square\_size>)

    <expr\_list> :- either a single scalar expression or a list of an odd number of scalar expressions.

    <square\_size> :- a positive integer.

    band_matrixcreates a square matrix of dimension <square\_size>. The diagonal consists of the middle expression of the <expr\_list>. The expressions to the left of this fill the required number of sub_diagonals and the expressions to the right the super_diagonals.

    examples:

    
    
    band_matrix({x,y,z},6) 
    
      [y  z  0  0  0  0]
      [                ]
      [x  y  z  0  0  0]
      [                ]
      [0  x  y  z  0  0]
      [                ]
      [0  0  x  y  z  0]
      [                ]
      [0  0  0  x  y  z]
      [                ]
      [0  0  0  0  x  y]
    
    

    Related functions: diagonal.

    block_matrix

    REDUC
E

    INDEX

    BLOCK_MATRIX _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    block_matrix(<r>,<c>,<matrix\_list>)

    <r>,<c> :- positive integers.

    <matrix\_list> :- a list of matrices.

    block_matrixcreates a matrix that consists of <r> by <c> matrices filled from the <matrix\_list> row wise.

    examples:

    
    B := make_identity(2); 
    
           [1  0]
      b := [    ]
           [0  1]
    
    
    
    C := mat((5),(5)); 
    
           [5]
      c := [ ]
           [5]
    
    
    
    D := mat((22,33),(44,55)); 
    
           [22  33]
      d := [      ]
           [44  55]
    
    
    
    block_matrix(2,3,{B,C,D,D,C,B}); 
    
    
      [1   0   5  22  33]
      [                 ]
      [0   1   5  44  55]
      [                 ]
      [22  33  5  1   0 ]
      [                 ]
      [44  55  5  0   1 ]
    
    

    char_matrix

    REDUC
E

    INDEX

    CHAR_MATRIX _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    char_matrix(<matrix>,<lambda>)

    <matrix> :- a square matrix. <lambda> :- a symbol or algebraic expression.

    <char\_matrix> creates the characteristic matrix C of <matrix>.

    This is C = <lambda> * Id - A. Id is the identity matrix.

    examples:

    
    
    char_matrix(A,x); 
    
      [x - 1   -2     -3  ]
      [                   ]
      [ -4    x - 5   -6  ]
      [                   ]
      [ -7     -8    x - 9]
    
    

    Related functions: char_poly.

    char_poly

    REDUC
E

    INDEX

    CHAR_POLY _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    char_poly(<matrix>,<lambda>)

    <matrix> :- a square matrix.

    <lambda> :- a symbol or algebraic expression.

    char_polyfinds the characteristic polynomial of <matrix>. This is the determinant of <lambda> * Id - A. Id is the identity matrix.

    examples:

    
    char_poly(A,x); 
    
       3     2
      x -15*x -18*x
    
    

    Related functions: char_matrix.

    cholesky

    REDUC
E

    INDEX

    CHOLESKY _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    cholesky(<matrix>)

    <matrix> :- a positive definite matrix containing numeric entries.

    choleskycomputes the cholesky decomposition of <matrix>.

    It returns {L,U} where L is a lower matrix, U is an upper matrix, A = LU, and U = L^T.

    examples:

    
    F := mat((1,1,0),(1,3,1),(0,1,1)); 
    
    
           [1  1  0]
           [       ]
      f := [1  3  1]
           [       ]
           [0  1  1]
    
    
    
    on rounded; 
    
    cholesky(F); 
    
      {
       [1        0               0       ]
       [                                 ]
       [1  1.41421356237         0       ]
       [                                 ]
       [0  0.707106781187  0.707106781187]
       ,
       [1        1              0       ]
       [                                ]
       [0  1.41421356237  0.707106781187]
       [                                ]
       [0        0        0.707106781187]
      }
    
    

    Related functions: lu_decom.

    coeff_matrix

    REDUC
E

    INDEX

    COEFF_MATRIX _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    coeff_matrix({<lineq\_list>})

    (If you are feeling lazy then the braces can be omitted.)

    <lineq\_list> :- linear equations. Can be of the form equation = number or just equation.

    coeff_matrixcreates the coefficient matrix C of the linear equations.

    It returns {C,X,B} such that CX = B.

    examples:

    
    
    coeff_matrix({x+y+4*z=10,y+x-z=20,x+y+4}); 
    
    
      {
       [4   1  1]
       [        ]
       [-1  1  1]
       [        ]
       [0   1  1]
       ,
       [z]
       [ ]
       [y]
       [ ]
       [x]
       ,
       [10]
       [  ]
       [20]
       [  ]
       [-4]
      }
    
    

    column_dim

    REDUC
E

    INDEX

    COLUMN_DIM _ _ _ _ _ _ _ _ _ _ _ _ operator

    Column dimension, row dimension:

    syntax:

    column_dim(<matrix>)

    <matrix> :- a matrix.

    column_dimfinds the column dimension of <matrix>.

    row_dimfinds the row dimension of <matrix>.

    examples:

    
    
    column_dim(A); 
    
      3 
    
    
    row_dim(A); 
    
      3 
    
    

    companion

    REDUC
E

    INDEX

    COMPANION _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    companion(<poly>,<x>)

    <poly> :- a monic univariate polynomial in <x>.

    <x> :- the variable.

    companioncreates the companion matrix C of <poly>.

    This is the square matrix of dimension n, where n is the degree of <poly> w.r.t. <x>.

    The entries of C are:

    C(i,n) = -coeffn(<poly>,<x>,i-1) for i = 1 ... n, C(i,i-1) = 1 for i = 2 ... n and the rest are 0.

    examples:

    
    
    companion(x^4+17*x^3-9*x^2+11,x); 
    
    
      [0  0  0  -11]
      [            ]
      [1  0  0   0 ]
      [            ]
      [0  1  0   9 ]
      [            ]
      [0  0  1  -17]
    
    

    Related functions: find_companion.

    copy_into

    REDUC
E

    INDEX

    COPY_INTO _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    copy_into(<A>,<B>,<r>,<c>)

    <A>,<B> :- matrices.

    <r>,<c> :- positive integers.

    copy_intocopies matrix <matrix> into <B> with <matrix>(1,1) at <B>(<r>,<c>).

    examples:

     
    
    G := mat((0,0,0,0,0),(0,0,0,0,0),(0,0,0,0,0),(0,0,0,0,0),(0,0,0,0,0)); 
    
    
           [0  0  0  0  0]
           [             ]
           [0  0  0  0  0]
           [             ]
      g := [0  0  0  0  0]
           [             ]
           [0  0  0  0  0]
           [             ]
           [0  0  0  0  0]
    
    
    
    copy_into(A,G,1,2); 
    
      [0  1  2  3  0]
      [             ]
      [0  4  5  6  0]
      [             ]
      [0  7  8  9  0]
      [             ]
      [0  0  0  0  0]
      [             ]
      [0  0  0  0  0]
    
    

    Related functions: augment_columns, extend, matrix_augment, matrix_stack, stack_rows, sub_matrix.

    diagonal

    REDUC
E

    INDEX

    DIAGONAL _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    diagonal({<mat\_list>})

    (If you are feeling lazy then the braces can be omitted.)

    <mat\_list> :- each can be either a scalar expression or a square matrix.

    diagonalcreates a matrix that contains the input on the diagonal.

    examples:

    
    
    H := mat((66,77),(88,99)); 
    
           [66  77]
      h := [      ]
           [88  99]
    
    
    
    diagonal({A,x,H}); 
    
      [1  2  3  0  0   0 ]
      [                  ]
      [4  5  6  0  0   0 ]
      [                  ]
      [7  8  9  0  0   0 ]
      [                  ]
      [0  0  0  x  0   0 ]
      [                  ]
      [0  0  0  0  66  77]
      [                  ]
      [0  0  0  0  88  99]
    
    

    Related functions: jordan_block.

    extend

    REDUC
E

    INDEX

    EXTEND _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    extend(<matrix>,<r>,<c>,<expr>)

    <matrix> :- a matrix.

    <r>,<c> :- positive integers.

    <expr> :- algebraic expression or symbol.

    extendreturns a copy of <matrix> that has been extended by <r> rows and <c> columns. The new entries are made equal to <expr>.

    examples:

    
    
    extend(A,1,2,x); 
    
      [1  2  3  x  x]
      [             ]
      [4  5  6  x  x]
      [             ]
      [7  8  9  x  x]
      [             ]
      [x  x  x  x  x]
    
    

    Related functions: copy_into, matrix_augment, matrix_stack, remove_columns, remove_rows.

    find_companion

    REDUC
E

    INDEX

    FIND_COMPANION _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    find_companion(<matrix>,<x>)

    <matrix> :- a matrix.

    <x> :- the variable.

    Given a companion matrix, find_companion finds the polynomial from which it was made.

    examples:

    
    
    C := companion(x^4+17*x^3-9*x^2+11,x); 
    
    
           [0  0  0  -11]
           [            ]
           [1  0  0   0 ]
      c := [            ]
           [0  1  0   9 ]
           [            ]
           [0  0  1  -17]
    
    
    
    find_companion(C,x); 
    
       4     3    2
      x +17*x -9*x +11
    
    

    Related functions: companion.

    get_columns

    REDUC
E

    INDEX

    GET_COLUMNS _ _ _ _ _ _ _ _ _ _ _ _ operator

    Get columns, get rows:

    syntax:

    get_columns(<matrix>,<column\_list>)

    <matrix> :- a matrix.

    <c> :- either a positive integer or a list of positive integers.

    get_columnsremoves the columns of <matrix> specified in <column\_list> and returns them as a list of column matrices.

    get_rowsperforms the same task on the rows of <matrix>.

    examples:

    
    
    get_columns(A,{1,3}); 
    
      {
       [1]
       [ ]
       [4]
       [ ]
       [7]
       ,
       [3]
       [ ]
       [6]
       [ ]
       [9]
      }
    
    
    
    get_rows(A,2); 
    
      {
       [4  5  6]
      }
    
    

    Related functions: augment_columns, stack_rows, sub_matrix.

    get_rows

    REDUC
E

    INDEX

    GET_ROWS _ _ _ _ _ _ _ _ _ _ _ _ operator

    see: get_columns.

    gram_schmidt

    REDUC
E

    INDEX

    GRAM_SCHMIDT _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    gram_schmidt({<vec\_list>})

    (If you are feeling lazy then the braces can be omitted.)

    <vec\_list> :- linearly independent vectors. Each vector must be written as a list, eg:{1,0,0}.

    gram_schmidtperforms the gram_schmidt orthonormalization on the input vectors.

    It returns a list of orthogonal normalized vectors.

    examples:

    
    
    gram_schmidt({{1,0,0},{1,1,0},{1,1,1}}); 
    
    
      {{1,0,0},{0,1,0},{0,0,1}} 
    
    
    
    gram_schmidt({{1,2},{3,4}}); 
    
    
            1         2        2*sqrt(5)   -sqrt(5)
      {{ ------- , ------- },{ --------- , -------- }}
         sqrt(5)   sqrt(5)         5          5
    
    

    hermitian_tp

    REDUC
E

    INDEX

    HERMITIAN_TP _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    hermitian_tp(<matrix>)

    <matrix> :- a matrix.

    hermitian_tpcomputes the hermitian transpose of <matrix>.

    This is a matrix in which the (i,j)'th entry is the con jugate of the (j,i)'th entry of <matrix>.

    examples:

    
    
    J := mat((i+1,i+2,i+3),(4,5,2),(1,i,0)); 
    
    
           [i + 1  i + 2  i + 3]
           [                   ]
      j := [  4      5      2  ]
           [                   ]
           [  1      i      0  ]
    
    
    
    hermitian_tp(j); 
    
      [ - i + 1  4   1  ]
      [                 ]
      [ - i + 2  5   - i]
      [                 ]
      [ - i + 3  2   0  ]
    
    

    Related functions: tp.

    hessian

    REDUC
E

    INDEX

    HESSIAN _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    hessian(<expr>,<variable\_list>)

    <expr> :- a scalar expression.

    <variable\_list> :- either a single variable or a list of variables.

    hessiancomputes the hessian matrix of <expr> w.r.t. the variables in <variable\_list>.

    This is an n by n matrix where n is the number of variables and the (i,j)'th entry is df(<expr>,<variable\_list>(i), <variable\_list>(j)).

    examples:

    
    
    hessian(x*y*z+x^2,{w,x,y,z}); 
    
      [0  0  0  0]
      [          ]
      [0  2  z  y]
      [          ]
      [0  z  0  x]
      [          ]
      [0  y  x  0]
    
    

    Related functions: df.

    hilbert

    REDUC
E

    INDEX

    HILBERT _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    hilbert(<square\_size>,<expr>)

    <square\_size> :- a positive integer.

    <expr> :- an algebraic expression.

    hilbertcomputes the square hilbert matrix of dimension <square\_size>.

    This is the symmetric matrix in which the (i,j)'th entry is 1/(i+j-<expr>).

    examples:

    
    
    hilbert(3,y+x); 
    
      [    - 1          - 1          - 1    ]
      [-----------  -----------  -----------]
      [ x + y - 2    x + y - 3    x + y - 4 ]
      [                                     ]
      [    - 1          - 1          - 1    ]
      [-----------  -----------  -----------]
      [ x + y - 3    x + y - 4    x + y - 5 ]
      [                                     ]
      [    - 1          - 1          - 1    ]
      [-----------  -----------  -----------]
      [ x + y - 4    x + y - 5    x + y - 6 ]
    
    

    jacobian

    REDUC
E

    INDEX

    JACOBIAN _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    jacobian(<expr\_list>,<variable\_list>)

    <expr\_list> :- either a single algebraic expression or a list of algebraic expressions.

    <variable\_list> :- either a single variable or a list of variables.

    jacobiancomputes the jacobian matrix of <expr\_list> w.r.t. <variable\_list>.

    This is a matrix whose (i,j)'th entry is df(<expr\_list> (i),<variable\_list>(j)).

    The matrix is n by m where n is the number of variables and m the number of expressions.

    examples:

    
     
    jacobian({x^4,x*y^2,x*y*z^3},{w,x,y,z}); 
    
    
      [      3                 ]
      [0  4*x     0       0    ]
      [                        ]
      [     2                  ]
      [0   y    2*x*y     0    ]
      [                        ]
      [      3     3          2]
      [0  y*z   x*z    3*x*y*z ]
    
    

    Related functions: hessian, df.

    jordan_block

    REDUC
E

    INDEX

    JORDAN_BLOCK _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    jordan_block(<expr>,<square\_size>)

    <expr> :- an algebraic expression or symbol.

    <square\_size> :- a positive integer.

    jordan_blockcomputes the square jordan block matrix J of dimension <square\_size>.

    The entries of J are:

    J(i,i) = <expr> for i=1 ... n, J(i,i+1) = 1 for i=1 ... n-1, and all other entries are 0.

    examples:

    
    
    jordan_block(x,5); 
    
      [x  1  0  0  0]
      [             ]
      [0  x  1  0  0]
      [             ]
      [0  0  x  1  0]
      [             ]
      [0  0  0  x  1]
      [             ]
      [0  0  0  0  x]
    
    

    Related functions: diagonal, companion.

    lu_decom

    REDUC
E

    INDEX

    LU_DECOM _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    lu_decom(<matrix>)

    <matrix> :- a matrix containing either numeric entries or imaginary entries with numeric coefficients.

    lu_decomperforms LU decomposition on <matrix>, ie: it returns {L,U} where L is a lower diagonal matrix, U an upper diagonal matrix and A = LU.

    Caution:

    The algorithm used can swap the rows of <matrix> during the calculation. This means that LU does not equal <matrix> but a row equivalent of it. Due to this, lu_decom returns {L,U,vec}. The call convert(meta{matrix,vec)} will return the matrix that has been decomposed, i.e: LU = convert(<matrix>,vec).

    examples:

    
    
    K := mat((1,3,5),(-4,3,7),(8,6,4)); 
    
    
           [1   3  5]
           [        ]
      k := [-4  3  7]
           [        ]
           [8   6  4]
    
    
    
    on rounded;
    
    lu :=  lu_decom(K); 
    
      lu := {
             [8    0      0  ]
             [               ]
             [-4  6.0     0  ]
             [               ]
             [1   2.25  1.125]
             ,
             [1  0.75  0.5]
             [            ]
             [0   1    1.5]
             [            ]
             [0   0     1 ]
             ,
             [3 2 3]}
    
    
    
    first lu * second lu; 
    
      [8   6.0  4.0]
      [            ]
      [-4  3.0  7.0]
      [            ]
      [1   3.0  5.0]
    
    
    
    convert(K,third lu); 
    
      P := mat((i+1,i+2,i+3),(4,5,2),(1,i,0));  _ _ _ 
           [i + 1  i + 2  i + 3]
           [                   ]
      p := [  4      5      2  ]
           [                   ]
           [  1      i      0  ]
    
    
    lu :=  lu_decom(P); 
    
      lu := {
             [  1        0                      0                ]
             [                                                   ]
             [  4     - 4*i + 5                 0                ]
             [                                                   ]
             [i + 1      3       0.414634146341*i + 2.26829268293]
             ,
             [1  i                 0                ]
             [                                      ]
             [0  1  0.19512195122*i + 0.243902439024]
             [                                      ]
             [0  0                 1                ]
             ,
             [3 2 3]}
    
    
    
    first lu * second lu; 
    
      [  1      i       0   ]
      [                     ]
      [  4      5      2.0  ]
      [                     ]
      [i + 1  i + 2  i + 3.0]
    
    
    
    convert(P,third lu); 
    
      [  1      i      0  ]
      [                   ]
      [  4      5      2  ]
      [                   ]
      [i + 1  i + 2  i + 3]
    
    

    Related functions: cholesky.

    make_identity

    REDUC
E

    INDEX

    MAKE_IDENTITY _ _ _ _ _ _ _ _ _ _ _ _ operator

    syntax:

    make_identity(<square\_size>)

    <square\_size> :- a positive integer.

    make_identitycreates the identity matrix of dimension <square\_size>.

    examples:

    
    
    make_identity(4); 
    
      [1  0  0  0]
      [          ]
      [0  1  0  0]
      [          ]
      [0  0  1  0]
      [          ]
      [0  0  0  1]
    
    

    Related functions: diagonal.