octave: Arithmetic Ops

 
 8.3 Arithmetic Operators
 ========================
 
 The following arithmetic operators are available, and work on scalars
 and matrices.  The element-by-element operators and functions broadcast
 (SeeBroadcasting).
 
 X + Y
      Addition.  If both operands are matrices, the number of rows and
      columns must both agree, or they must be broadcastable to the same
      shape.
 
 X .+ Y
      Element-by-element addition.  This operator is equivalent to ‘+’.
 
 X - Y
      Subtraction.  If both operands are matrices, the number of rows and
      columns of both must agree, or they must be broadcastable to the
      same shape.
 
 X .- Y
      Element-by-element subtraction.  This operator is equivalent to
      ‘-’.
 
 X * Y
      Matrix multiplication.  The number of columns of X must agree with
      the number of rows of Y.
 
 X .* Y
      Element-by-element multiplication.  If both operands are matrices,
      the number of rows and columns must both agree, or they must be
      broadcastable to the same shape.
 
 X / Y
      Right division.  This is conceptually equivalent to the expression
 
           (inverse (y') * x')'
 
      but it is computed without forming the inverse of Y’.
 
      If the system is not square, or if the coefficient matrix is
      singular, a minimum norm solution is computed.
 
 X ./ Y
      Element-by-element right division.
 
 X \ Y
      Left division.  This is conceptually equivalent to the expression
 
           inverse (x) * y
 
      but it is computed without forming the inverse of X.
 
      If the system is not square, or if the coefficient matrix is
      singular, a minimum norm solution is computed.
 
 X .\ Y
      Element-by-element left division.  Each element of Y is divided by
      each corresponding element of X.
 
 X ^ Y
 X ** Y
      Power operator.  If X and Y are both scalars, this operator returns
      X raised to the power Y.  If X is a scalar and Y is a square
      matrix, the result is computed using an eigenvalue expansion.  If X
      is a square matrix, the result is computed by repeated
      multiplication if Y is an integer, and by an eigenvalue expansion
      if Y is not an integer.  An error results if both X and Y are
      matrices.
 
      The implementation of this operator needs to be improved.
 
 X .^ Y
 X .** Y
      Element-by-element power operator.  If both operands are matrices,
      the number of rows and columns must both agree, or they must be
      broadcastable to the same shape.  If several complex results are
      possible, the one with smallest non-negative argument (angle) is
      taken.  This rule may return a complex root even when a real root
      is also possible.  Use ‘realpow’, ‘realsqrt’, ‘cbrt’, or ‘nthroot’
      if a real result is preferred.
 
 -X
      Negation.
 
 +X
      Unary plus.  This operator has no effect on the operand.
 
 X’
      Complex conjugate transpose.  For real arguments, this operator is
      the same as the transpose operator.  For complex arguments, this
      operator is equivalent to the expression
 
           conj (x.')
 
 X.’
      Transpose.
 
    Note that because Octave’s element-by-element operators begin with a
 ‘.’, there is a possible ambiguity for statements like
 
      1./m
 
 because the period could be interpreted either as part of the constant
 or as part of the operator.  To resolve this conflict, Octave treats the
 expression as if you had typed
 
      (1) ./ m
 
 and not
 
      (1.) / m
 
 Although this is inconsistent with the normal behavior of Octave’s
 lexer, which usually prefers to break the input into tokens by
 preferring the longest possible match at any given point, it is more
 useful in this case.
 
  -- : ctranspose (X)
      Return the complex conjugate transpose of X.
 
      This function and X’ are equivalent.
 
      See also: Seetranspose XREFtranspose.
 
  -- : ldivide (X, Y)
      Return the element-by-element left division of X and Y.
 
      This function and X .\ Y are equivalent.
 
      See also: Seerdivide XREFrdivide, Seemldivide XREFmldivide,
      Seetimes XREFtimes, Seeplus XREFplus.
 
  -- : minus (X, Y)
      This function and X - Y are equivalent.
 
      See also: Seeplus XREFplus, Seeuminus XREFuminus.
 
  -- : mldivide (X, Y)
      Return the matrix left division of X and Y.
 
      This function and X \ Y are equivalent.
 
      See also: Seemrdivide XREFmrdivide, Seeldivide XREFldivide,
      Seerdivide XREFrdivide.
 
  -- : mpower (X, Y)
      Return the matrix power operation of X raised to the Y power.
 
      This function and X ^ Y are equivalent.
 
DONTPRINTYET       See also: Seepower XREFpower, Seemtimes XREFmtimes, *noteDONTPRINTYET       See also: Seepower XREFpower, Seemtimes XREFmtimes, See
      plus XREFplus, Seeminus XREFminus.
 
  -- : mrdivide (X, Y)
      Return the matrix right division of X and Y.
 
      This function and X / Y are equivalent.
 
      See also: Seemldivide XREFmldivide, Seerdivide XREFrdivide,
      Seeplus XREFplus, Seeminus XREFminus.
 
  -- : mtimes (X, Y)
  -- : mtimes (X1, X2, ...)
      Return the matrix multiplication product of inputs.
 
      This function and X * Y are equivalent.  If more arguments are
      given, the multiplication is applied cumulatively from left to
      right:
 
           (...((X1 * X2) * X3) * ...)
 
      At least one argument is required.
 
DONTPRINTYET       See also: Seetimes XREFtimes, Seeplus XREFplus, *noteDONTPRINTYET DONTPRINTYET       See also: Seetimes XREFtimes, Seeplus XREFplus, See
      minus XREFminus, Seerdivide XREFrdivide, *notemrdivide:
DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seetimes XREFtimes, Seeplus XREFplus, See
      minus XREFminus, Seerdivide XREFrdivide, Seemrdivide

      XREFmrdivide, Seemldivide XREFmldivide, *notempower:
DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seetimes XREFtimes, Seeplus XREFplus, See
      minus XREFminus, Seerdivide XREFrdivide, Seemrdivide

      XREFmrdivide, Seemldivide XREFmldivide, Seempower

      XREFmpower.
 
  -- : plus (X, Y)
  -- : plus (X1, X2, ...)
      This function and X + Y are equivalent.
 
      If more arguments are given, the summation is applied cumulatively
      from left to right:
 
           (...((X1 + X2) + X3) + ...)
 
      At least one argument is required.
 
      See also: Seeminus XREFminus, Seeuplus XREFuplus.
 
  -- : power (X, Y)
      Return the element-by-element operation of X raised to the Y power.
 
      This function and X .^ Y are equivalent.
 
      If several complex results are possible, returns the one with
      smallest non-negative argument (angle).  Use ‘realpow’, ‘realsqrt’,
      ‘cbrt’, or ‘nthroot’ if a real result is preferred.
 
      See also: Seempower XREFmpower, Seerealpow XREFrealpow,
DONTPRINTYET       Seerealsqrt XREFrealsqrt, Seecbrt XREFcbrt, *notenthroot:
DONTPRINTYET       Seerealsqrt XREFrealsqrt, Seecbrt XREFcbrt, Seenthroot

      XREFnthroot.
 
  -- : rdivide (X, Y)
      Return the element-by-element right division of X and Y.
 
      This function and X ./ Y are equivalent.
 
      See also: Seeldivide XREFldivide, Seemrdivide XREFmrdivide,
      Seetimes XREFtimes, Seeplus XREFplus.
 
  -- : times (X, Y)
  -- : times (X1, X2, ...)
      Return the element-by-element multiplication product of inputs.
 
      This function and X .* Y are equivalent.  If more arguments are
      given, the multiplication is applied cumulatively from left to
      right:
 
           (...((X1 .* X2) .* X3) .* ...)
 
      At least one argument is required.
 
      See also: Seemtimes XREFmtimes, Seerdivide XREFrdivide.
 
  -- : transpose (X)
      Return the transpose of X.
 
      This function and X.’ are equivalent.
 
      See also: Seectranspose XREFctranspose.
 
  -- : uminus (X)
      This function and - X are equivalent.
 
      See also: Seeuplus XREFuplus, Seeminus XREFminus.
 
  -- : uplus (X)
      This function and + X are equivalent.
 
DONTPRINTYET       See also: Seeuminus XREFuminus, Seeplus XREFplus, *noteDONTPRINTYET       See also: Seeuminus XREFuminus, Seeplus XREFplus, See
      minus XREFminus.