Language Reference

Power Operator, Elementwise:   ##

raises each element to a power

matrix1##matrix2
matrix##scalar
matrix##vector

The elementwise power operator (##) creates a new matrix with elements that are the elements of matrix1 raised to the power of the corresponding element of matrix2. If any value in matrix1 is negative, the corresponding element in matrix2 must be an integer.

In addition to handling conformable matrices, the elementwise power operator enables either operand to be a scalar or a row or column vector. If either operand is scalar, the operation takes the power for each element and the scalar value. If either operand is a row or column vector, the operation is applied elementwise using the vector on each row or column of the matrix.

Missing values are propagated if they occur.

For example, the following statements produce the matrix b, as shown:

  
    a={1 2 3}; 
    b=a##3;
 

  
               B            1 row      2 cols     (numeric) 
  
                                 1         8       27
 
The following statement produces the new matrix b, as shown:
  
    b=a##.5;
 

  
                B             1 row       3 cols    (numeric) 
  
                           1 1.4142136 1.7320508
 

Previous Page | Next Page | Top of Page