Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: Français - Português - 日本語 - Русский
Scilab Help >> Scilab > Scilab keywords > slash

slash

(/) right division and feed back

Description

Right division: X=A/B is the solution of X*B=A.

The slash (right division) and backslash (left division) operators are linked by the following equation: B/A=(A'\B')'.

In the case where A is square, the solution X can be computed either from LU factorization or from a linear least squares solver. If the condition number of A is smaller than 1/(10*%eps) (i.e. if A is well conditioned), the LU factorization with row pivoting is used. If not (i.e. if A is poorly conditioned), then X is the minimum-norm solution which minimizes ||A*X-B|| using a complete orthogonal factorization of A (i.e. X is the solution of a linear least squares problem).

A./B is the element-wise right division, i.e. the matrix with entries A(i,j)/B(i,j). If B is scalar (1x1 matrix) this operation is the same as A./B*ones(A). Same convention if A is a scalar.

System feed back. S = G/.K evaluates S = G*(eye() + K*G)^(-1) this operator avoid simplification problem.

Note that 123./B is interpreted as (123)./B. In this case, the dot is part of the operator, not of the decimal number.

In the opposite, G/.5 is interpreted as G/(.5) : The dot here is part of the number, while it is not the case in G/. 5

Comment // comments a line i.e. lines which begin by // are ignored by the interpreter.

It is the same with /* which start to comment a block of code and with */ which end to comment this block.

Examples

a = [3.,-24.,30.];
B = [
   9.   -36.    30.
  -36.   192.  -180.
   30.  -180.   180.
];
x = a / B
x*B-a // close to zero

a = 4 / 2; // Should be 2
a = 2 ./ [2,4]; //     1.    0.5

// Comments are good. They help to understand code
/* Even long, that is to say on many lines,
comments are useful */

See also

  • inv — matrix inverse
  • backslash — (\) left matrix division.
  • comments — (// or /*...*/) comments

History

VersionDescription
5.4.1 The threshold level which switches between Gaussian Elimination with row pivoting and linear least squares when computing B/A is decreased from sqrt(eps) to eps.
6.0.0 1./B means now 1 ./ B, no longer 1. / B
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Feb 14 14:57:05 CET 2019