<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Le 20/03/2020 à 14:42, Stéphane
Mottelet a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:80458f49-e6d8-e414-1618-8f1e99f2fe6a@utc.fr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<p>(num,den) calling style seems to be OK:</p>
<p>--> [a,b]=simp(prod(q.num),prod(q.den))<br>
a = <br>
2 3 4<br>
3.432D-17 +1.230D-16s +3.079D-16s +5.709D-17s +3.432D-17s <br>
<br>
b = <br>
2 3 4<br>
1.0000004 +61.501079s +59.597296s +14.304769s +s <br>
</p>
<p>The problem is in %r_simp code, which does a cleaning, but not
a complete one. If fact we should have the same result when the
cleaning is done afterwards :<br>
</p>
<p>--> clean(a/b)<br>
ans =<br>
0 <br>
-- <br>
1 <br>
</p>
</blockquote>
<p><br>
</p>
<p>My fault. When i introduced cleaning in %r_simp in order to
manage the <a moz-do-not-send="true"
href="http://bugzilla.scilab.org/show_bug.cgi?id=13893">bugs
13893</a>, i did not pay attention to the crude default clean()
tolerances triggering the cleaning and used as is.<br>
In addition, i do not remember if keeping the initial numerator
was intentional or not, instead of actually setting it to 0. Still
now, i am not sure neither that it should be set to 0, nor the
opposite. Please see below.</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:80458f49-e6d8-e414-1618-8f1e99f2fe6a@utc.fr">
<p> </p>
<p>which is OK to me when you see this:<br>
</p>
<p>--> w=10^(1:6); abs(horner(a/b,%i*w))<br>
ans =<br>
<br>
2.224D-17 3.415D-17 3.432D-17 3.432D-17 3.432D-17
3.432D-17<br>
</p>
</blockquote>
<p><br>
IMHO, despite these low results, considering them as small enough
to be cleaned is still quite questionable. We could have a
numerator with all coefficients < %eps but still all
meaningful.<br>
<br>
I am wondering about the cleaning conditions used for rationals:<br>
edit %r_clean<br>
> <span style="color:rgb(0,0,0);">a </span><span
style="color:rgb(92,92,92);">= </span><span
style="color:rgb(50,185,185);">simp</span><span
style="color:rgb(74,85,219);">(</span><span
style="color:rgb(50,185,185);">clean</span><span
style="color:rgb(74,85,219);">(</span><span
style="color:rgb(0,0,0);">a</span><span
style="color:rgb(74,85,219);">(</span><span
style="color:rgb(188,143,143);">"</span><span
style="color:rgb(188,143,143);">num</span><span
style="color:rgb(188,143,143);">"</span><span
style="color:rgb(74,85,219);">)</span><span
style="color:rgb(0,0,0);">,</span><span
style="color:rgb(0,0,0);"> epsa</span><span
style="color:rgb(0,0,0);">, </span><span
style="color:rgb(0,0,0);">epsr</span><span
style="color:rgb(74,85,219);">)</span><span
style="color:rgb(92,92,92);"> ./ </span><span
style="color:rgb(50,185,185);">clean</span><span
style="color:rgb(74,85,219);">(</span><span
style="color:rgb(0,0,0);">a</span><span
style="color:rgb(74,85,219);">(</span><span
style="color:rgb(188,143,143);">"</span><span
style="color:rgb(188,143,143);">den</span><span
style="color:rgb(188,143,143);">"</span><span
style="color:rgb(74,85,219);">)</span><span
style="color:rgb(0,0,0);">,</span><span
style="color:rgb(0,0,0);"> epsa</span><span
style="color:rgb(0,0,0);">, </span><span
style="color:rgb(0,0,0);">epsr</span><span
style="color:rgb(74,85,219);">)</span><span
style="color:rgb(74,85,219);">)</span><span
style="color:rgb(0,0,0);">;<br>
</span><span style="color:rgb(0,0,0);"></span><br>
The numerators and the denominators are cleaned separately. <br>
How to apply any absolute tolerance is quite clear (although
unsafe). IMHO the absolute tolerance must be set to 0 (so not
keeping the default one set to 1e-10), for the reason given
hereabove.<br>
How to use and apply the relative tolerance is more debatable.
Presently, for a given rational, no comparison is done between
coefficients of its numerator and the corresponding ones of its
denominator. We could consider doing things is this way.</p>
<p>Any other input is welcome.<br>
Regards<br>
Samuel</p>
<br>
</body>
</html>