<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<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>
</body>
</html>