Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.1 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

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.

Remark that 123./B is interpreted as (123.)/B. In this cases dot is part of the number not of the operator.

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

Remark that G/.5 is interpreted as G/(.5). In such cases dot is part of the number, not of the operator.

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 for conditioning in slash increased.
Report an issue
<< semicolon Scilab keywords star >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Feb 12 19:26:46 CET 2018