<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello Frederico,</p>
    <p>The problem is in simp() :</p>
    <p>---> rlist(prod(a.num),prod(a.den),a.dt)<br>
       ans  =<br>
      <br>
                                            2            3            4 
      <br>
         3.432D-17 + 1.230D-16s + 3.079D-16s + 5.709D-17s + 3.432D-17s  
      <br>
         -------------------------------------------------------------- 
      <br>
                                                2            3   4      
      <br>
             1.0000004 + 61.501079s + 59.597296s + 14.304769s + s       
      <br>
      <br>
      <br>
      ---> simp(rlist(prod(a.num),prod(a.den),a.dt))<br>
       ans  =<br>
      <br>
                                            2            3            4 
      <br>
         3.432D-17 + 1.230D-16s + 3.079D-16s + 5.709D-17s + 3.432D-17s  
      <br>
         -------------------------------------------------------------- 
      <br>
                                                                        
      <br>
                                       1          <br>
    </p>
    <p>S.<br>
    </p>
    <div class="moz-cite-prefix">Le 17/03/2020 à 10:30, Federico Miyara
      a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:d2aadaf6-b35f-850b-797b-ad627bbf624f@fceia.unr.edu.ar">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <br>
      <font face="Courier New">Dear all, <br>
        <br>
        Look at this code (the coefficients are actually the result of
        pevious calculations):<br>
      </font><span style="color:rgb(0,0,0);"><br>
      </span><span style="color:rgb(0,0,0);">NUM</span> <span
        style="color:rgb(92,92,92);">=</span> <span
        style="color:rgb(74,85,219);">[</span><span
        style="color:rgb(188,143,143);">5.858D-09</span> <span
        style="color:rgb(92,92,92);">+</span> <span
        style="color:rgb(188,143,143);">2.011D-08</span><span
        style="color:rgb(92,92,92);">*</span><span
        style="color:rgb(218,112,214);">%s</span> <span
        style="color:rgb(92,92,92);">+</span> <span
        style="color:rgb(188,143,143);">4.884D-08</span><span
        style="color:rgb(92,92,92);">*</span><span
        style="color:rgb(218,112,214);">%s</span><span
        style="color:rgb(92,92,92);">^</span><span
        style="color:rgb(188,143,143);">2</span> <span
        style="color:rgb(255,170,0);">...</span> <br>
             <span style="color:rgb(188,143,143);">5.858D-09</span> <span
        style="color:rgb(92,92,92);">+</span> <span
        style="color:rgb(188,143,143);">8.796D-10</span><span
        style="color:rgb(92,92,92);">*</span><span
        style="color:rgb(218,112,214);">%s</span> <span
        style="color:rgb(92,92,92);">+</span> <span
        style="color:rgb(188,143,143);">7.028D-10</span><span
        style="color:rgb(92,92,92);">*</span><span
        style="color:rgb(218,112,214);">%s</span><span
        style="color:rgb(92,92,92);">^</span><span
        style="color:rgb(188,143,143);">2</span><span
        style="color:rgb(74,85,219);">]</span> <span
        style="color:rgb(0,0,0);"><br>
        DEN</span> <span style="color:rgb(92,92,92);">=</span> <span
        style="color:rgb(74,85,219);">[</span><span
        style="color:rgb(188,143,143);">0.1199597</span> <span
        style="color:rgb(92,92,92);">+</span> <span
        style="color:rgb(188,143,143);">7.2765093</span><span
        style="color:rgb(92,92,92);">*</span><span
        style="color:rgb(218,112,214);">%s</span> <span
        style="color:rgb(92,92,92);">+</span> <span
        style="color:rgb(218,112,214);">%s</span><span
        style="color:rgb(92,92,92);">^</span><span
        style="color:rgb(188,143,143);">2</span> <span
        style="color:rgb(255,170,0);">...</span> <br>
      <span style="color:rgb(188,143,143);">       8.336136</span> <span
        style="color:rgb(92,92,92);">+</span>  <span
        style="color:rgb(188,143,143);">7.0282601</span><span
        style="color:rgb(92,92,92);">*</span><span
        style="color:rgb(218,112,214);">%s</span> <span
        style="color:rgb(92,92,92);">+</span> <span
        style="color:rgb(218,112,214);">%s</span><span
        style="color:rgb(92,92,92);">^</span><span
        style="color:rgb(188,143,143);">2</span><span
        style="color:rgb(74,85,219);">]</span> <span
        style="color:rgb(0,0,0);"><br>
        q = NUM</span><span style="color:rgb(92,92,92);">./</span><span
        style="color:rgb(0,0,0);">DEN<br>
      </span> <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:rgb(50,185,185);">prod</span><span
        style="color:rgb(74,85,219);">(</span><span
        style="color:rgb(0,0,0);">NUM</span><span
        style="color:rgb(92,92,92);">./</span><span
        style="color:rgb(0,0,0);">DEN</span><span
        style="color:rgb(74,85,219);">)</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:rgb(50,185,185);">prod</span><span
        style="color:rgb(74,85,219);">(</span><span
        style="color:rgb(0,0,0);">NUM</span><span
        style="color:rgb(74,85,219);">)</span><span
        style="color:rgb(92,92,92);">/</span><span
        style="color:rgb(50,185,185);">prod</span><span
        style="color:rgb(74,85,219);">(</span><span
        style="color:rgb(0,0,0);">DEN</span><span
        style="color:rgb(74,85,219);">)<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<br>
      <span style="color:rgb(74,85,219);"></span> <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="https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users">https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
<a class="moz-txt-link-freetext" href="http://www.utc.fr/~mottelet">http://www.utc.fr/~mottelet</a>
</pre>
  </body>
</html>