Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.1 - 日本語

Change language to:
English - 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ヘルプ >> Scilab > types > rational

rational

Scilab オブジェクト, Scilabの有理数

説明

有理数 r は,2つの多項式の商r=num/denです. 有理数の内部表現はリストです.

An array R of rationals can be directly defined as the elementwise quotient of two polynomial 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.

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

参照

  • poly — Polynomial definition from given roots or coefficients, or characteristic to a square matrix.
  • syslin — 線形システムを定義する
  • horner — 多項式/有理数の評価
  • simp — 有理数の簡単化

履歴

バージョン記述
6.0.2 The syntax R(k,0) is now available to address components with their linearized indices k.
Report an issue
<< matrices types strings >>

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:
Mon Jan 03 14:37:44 CET 2022