[Scilab-users] indexing array of rationals
Federico Miyara
fmiyara at fceia.unr.edu.ar
Thu Jul 22 23:55:36 CEST 2021
Stéphane,
You may try, if k is the index,
pi(2)(k)/pi(3)(k)
This is because a rational is a list and the first element is a vector
of strings describing the structure, not a component of the matrix of
rationals.
Indeed I think there is not such a thing as a matrix of rationals, but a
rational (so, itself a list) whose components 2 and 3 are matrices of
polynomials; respectively, numerator and denominator polynomials.
When one tries to create a matrix of lists (general lists, not
rationals) it yields an error:
a = list( 1, "a", %s);
b = list( 2, "b", %z);
c = [a,b]
The error message is
Undefined operation for the given operands.
check or define function %l_c_l for overloading.
When the lists are specifically rtationals, the command works fine, for
instance
d = [(1+%s)/(1+2*%s), (1-%s)/(1+%s+2*%s^2)]
but it is not a matrix of rationals but a rational whose numerator and
denominator fields are matrices of polynomials
Regards,
Federico Miyara
On 22/07/2021 17:08, Stéphane Mottelet wrote:
> Hi all,
>
> I thought indexing an array of rationals was possible. Likely this is
> no possible and this is a pity
>
> --> pi
> pi =
>
> θ +2θ²
> ----------
> 1 +4θ +3θ²
>
> 0.3333333θ
> ------------
> 0.3333333 +θ
>
> 0.3333333θ
> ------------
> 0.3333333 +θ
>
> θ +2θ²
> ----------
> 1 +4θ +3θ²
>
> --> pi(1)
> ans =
>
> "r" "num" "den" "dt"
>
> Any clue, somebody ?
>
--
El software de antivirus Avast ha analizado este correo electrónico en busca de virus.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20210722/f14481a0/attachment.htm>
More information about the users
mailing list