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

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

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

Scilab Help >> Polynomials > rational

rational

rational fractions

Description

A rational r is the quotient of two polynomials r=num/den.

An array R of rationals can be directly defined as the elementwise quotient of two polynomials arrays Num and Den : R = Num./Den.

The internal representation of a rational is a list of type "r": R = tlist(['r','num','den','dt'], Num, Den,[]), or R = rlist(Num, Den, []).

All usual operators can be used with arrays of rationals: ' .' + - * .* / ./ .^ .*. [,] [;],

As for polynomials, the horner() function allows to compute the value of rationals for some value of their variable.

Many other Scilab functions can be used with rationals input : permute, cat, real, imag, conj, isreal, etc.

Addressing some components of an array R of rationals with their linearized indices can be done using the syntax R(k,0) where k is the vector of linearized indices, and 0 is used instead of j or higher order indices.

Examples

s=poly(0,'s');
W=[1/s,1/(s+1)]
W'*W
Num=[s,s+2;1,s];Den=[s*s,s;s,s*s];
rlist(Num,Den,[])
H=Num./Den
syslin('c',Num,Den)
syslin('c',H)
[Num1,Den1]=simp(Num,Den)

R = (1-%s).^[1 0 2] ./ %s.^[1 2 0]
horner(R,[-1 0 2 -2]')

R = (1-%s)/(1+%s)
horner(R, 1-%z^2)
--> R = (1-%s).^[1 0 2] ./ %s.^[1 2 0]
 R  =
                         2
   1 - s   1   1 - 2s + s
   ------  --  -----------
            2
     s     s       1

--> horner(R,[-1 0 2 -2]')
 ans  =
  -2.    1.     4.
   Inf   Inf    1.
  -0.5   0.25   1.
  -1.5   0.25   9.

--> R = (1-%s)/(1+%s)
 R  =
   1 - s
   ------
   1 + s

--> horner(R, 1-%z^2)
 ans  =
      2
     z
   ------
        2
   2 - z

See also

  • poly — Polynomial definition from given roots or coefficients, or characteristic to a square matrix.
  • syslin — linear system definition
  • horner — polynomial/rational evaluation
  • simp — rational simplification

History

VersionDescription
6.0.2 The syntax R(k,0) is now available to address components with their linearized indices k.
Report an issue
<< poly Polynomials residu >>

Copyright (c) 2022-2024 (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:
Thu Feb 14 14:57:17 CET 2019