<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<font face="Courier New">Pierre,<br>
<br>
Thanks for your answer.<br>
<br>
However, I believe no involved computatins are required to get the
correct result. The multiplication of the two polynomials from the
denominators is straightforward, no need to solve any system, no
risk of ill-conditioned or badly-scaled matrices. <br>
<br>
This must be another kind of problem.<br>
<br>
Regards,<br>
<br>
Federico Miyara<br>
</font><br>
<div class="moz-cite-prefix">On 17/03/2020 06:48, Perrichon wrote:<br>
</div>
<blockquote type="cite"
cite="mid:!&!AAAAAAAAAAAuAAAAAAAAAHTRbxuKTONJuQv%2FnFKuTP8BANlTnCJhprtFudq2LHCBs8EBACQA%2F%2F8AABAAAADDpug1OLtUTo7T8B7tnbUNAQAAAAA=@wanadoo.fr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span
style="color:windowtext;mso-fareast-language:EN-US">Hello
Federico<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="color:windowtext;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="color:windowtext;mso-fareast-language:EN-US">I have
met few months or years ago this problem when i was
developping my « OPTSIM Solution » software to fix
parameters of a PID for turbines (30 mw to 2 gw) in Nyquist
and Bode Plans with hydraulic parameters site<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="color:windowtext;mso-fareast-language:EN-US">So I’ve
seen instability of the denominator, witch damage calculus.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="color:windowtext;mso-fareast-language:EN-US">I don ‘t
remember what I’ve done to get a cool solution, but it has
been a hard and severe problem with syslin, tf2ss and ss2tf
instructions <o:p></o:p></span></p>
<p class="MsoNormal"><span
style="color:windowtext;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="color:windowtext;mso-fareast-language:EN-US">Sincerely<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="color:windowtext;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="color:windowtext;mso-fareast-language:EN-US">Pierre
P.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="color:windowtext;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="color:windowtext;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="color:windowtext">De :</span></b><span
style="color:windowtext"> users
<a class="moz-txt-link-rfc2396E" href="mailto:users-bounces@lists.scilab.org"><users-bounces@lists.scilab.org></a> <b>De la part de</b>
Federico Miyara<br>
<b>Envoyé :</b> mardi 17 mars 2020 10:31<br>
<b>À :</b> Users mailing list for Scilab
<a class="moz-txt-link-rfc2396E" href="mailto:users@lists.scilab.org"><users@lists.scilab.org></a><br>
<b>Objet :</b> [Scilab-users] Strange behaviour of prod
on rationals<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><br>
<span style="font-family:"Courier New"">Dear all, <br>
<br>
Look at this code (the coefficients are actually the result
of pevious calculations):<br>
</span><br>
NUM <span style="color:#5C5C5C">=</span> <span
style="color:#4A55DB">[</span><span style="color:rosybrown">5.858D-09</span>
<span style="color:#5C5C5C">+</span> <span
style="color:rosybrown">2.011D-08</span><span
style="color:#5C5C5C">*</span><span style="color:orchid">%s</span>
<span style="color:#5C5C5C">+</span> <span
style="color:rosybrown">4.884D-08</span><span
style="color:#5C5C5C">*</span><span style="color:orchid">%s</span><span
style="color:#5C5C5C">^</span><span style="color:rosybrown">2</span>
<span style="color:#FFAA00">...</span> <br>
<span style="color:rosybrown">5.858D-09</span> <span
style="color:#5C5C5C">+</span> <span
style="color:rosybrown">8.796D-10</span><span
style="color:#5C5C5C">*</span><span style="color:orchid">%s</span>
<span style="color:#5C5C5C">+</span> <span
style="color:rosybrown">7.028D-10</span><span
style="color:#5C5C5C">*</span><span style="color:orchid">%s</span><span
style="color:#5C5C5C">^</span><span style="color:rosybrown">2</span><span
style="color:#4A55DB">]</span> <br>
DEN <span style="color:#5C5C5C">=</span> <span
style="color:#4A55DB">[</span><span style="color:rosybrown">0.1199597</span>
<span style="color:#5C5C5C">+</span> <span
style="color:rosybrown">7.2765093</span><span
style="color:#5C5C5C">*</span><span style="color:orchid">%s</span>
<span style="color:#5C5C5C">+</span> <span
style="color:orchid">%s</span><span style="color:#5C5C5C">^</span><span
style="color:rosybrown">2</span> <span
style="color:#FFAA00">...</span> <br>
<span style="color:rosybrown"> 8.336136</span> <span
style="color:#5C5C5C">+</span> <span
style="color:rosybrown">7.0282601</span><span
style="color:#5C5C5C">*</span><span style="color:orchid">%s</span>
<span style="color:#5C5C5C">+</span> <span
style="color:orchid">%s</span><span style="color:#5C5C5C">^</span><span
style="color:rosybrown">2</span><span style="color:#4A55DB">]</span>
<br>
q = NUM<span style="color:#5C5C5C">./</span>DEN<br>
<br>
Running it yields<br>
<br>
5.858D-09 +2.011D-08s +4.884D-08s² 5.858D-09 +8.796D-10s
+7.028D-10s² <br>
----------------------------------
---------------------------------- <br>
0.1199597 +7.2765093s +s² 8.336136
+7.0282601s +s² <br>
<br>
This is, correctly, a two-component rational vector with the
expected numerators and denominators. <br>
<br>
Now let's evaluate <br>
<br>
q = <span style="color:#32B9B9">prod</span><span
style="color:#4A55DB">(</span>NUM<span style="color:#5C5C5C">./</span>DEN<span
style="color:#4A55DB">)</span> <br>
<br>
The prod documantation sys that the argument may be "an array
of reals, complex, booleans, polynomials or rational
fractions". It should provide the rational obtained by
multiplying the twonumrators and the two denominators.
However, we get<br>
<br>
3.432D-17 +1.230D-16s +3.079D-16s² +5.709D-17s³
+3.432D-17s⁴ <br>
------------------------------------------------------------
<br>
1 <br>
<br>
The numeratoris right, but the expected denominator has been
just replaced by 1<br>
<br>
However, rewriting the command as<br>
<br>
<span style="color:#32B9B9">prod</span><span
style="color:#4A55DB">(</span>NUM<span style="color:#4A55DB">)</span><span
style="color:#5C5C5C">/</span><span style="color:#32B9B9">prod</span><span
style="color:#4A55DB">(</span>DEN<span style="color:#4A55DB">)<br>
<br>
</span>we get the expected result:<br>
<br>
3.432D-17 +1.230D-16s +3.079D-16s² +5.709D-17s³
+3.432D-17s⁴ <br>
------------------------------------------------------------
<br>
1.0000004 +61.501079s +59.597296s² +14.304769s³
+s⁴ <br>
<br>
This is quite strange!<br>
<br>
Now we repeat with simpler polynomials:<br>
<br>
NUM = [1-%s 2-%s]<br>
DEN = [1+%s 2+%s]<br>
q = NUM./DEN <br>
<br>
We get <br>
<br>
1 -s 2 -s <br>
---- ---- <br>
1 +s 2 +s <br>
<br>
Now evaluate<br>
<br>
prod(NUM./DEN)<br>
<br>
The result is the expected one!<br>
<br>
2 -3s +s² <br>
--------- <br>
2 +3s +s² <br>
<br>
The behavior seems to depend on the type of polynomials. <br>
<br>
Is this a bug or there is something I'm not interpreting
correctly?<br>
<br>
Regards,<br>
<br>
Federico Miyara<o:p></o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>