<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Dear Scilab Users</p>
<p>I have a script, which imitates a Fortran script. I can see
there's a difference in calculation of about 1%, which is very
strange to me. Input parameters (dz1 and dz2 vectors, length 1200)
to the equation seem to agree within 0,1% ... so right now my
theory is that the precision slips away when I do the following
calculation:</p>
<p>Scilab: <span style="color:rgb(0,0,0);">zm_star</span> <span
style="color:rgb(92,92,92);">=</span> <span
style="color:rgb(74,85,219);">(</span><span
style="color:rgb(188,143,143);">1</span><span
style="color:rgb(92,92,92);">-</span><span
style="color:rgb(0,0,0);">mu</span><span
style="color:rgb(74,85,219);">)</span><span
style="color:rgb(92,92,92);">*</span> <span
style="color:rgb(0,0,0);">dz1</span> <span
style="color:rgb(92,92,92);">.*</span> <span
style="color:rgb(0,0,0);">dz2</span> <span
style="color:rgb(92,92,92);">./</span> <span
style="color:rgb(74,85,219);">(</span><span
style="color:rgb(0,0,0);">dz2</span><span
style="color:rgb(92,92,92);">-</span><span
style="color:rgb(0,0,0);">mu</span><span
style="color:rgb(92,92,92);">*</span><span
style="color:rgb(0,0,0);">dz1</span><span
style="color:rgb(74,85,219);">)</span><span
style="color:rgb(0,0,0);">;</span> <span
style="color:rgb(100,174,100);font-style:italic;">// model free
mech. impedance</span></p>
<p>Fortran: zm_star = (1-mu)*dz1*dz2/(dz2-mu*dz1)<br>
</p>
<p>Do you see anything in the Scilab formulation, which should worry
me / which would give me such a high error?</p>
<p>P.S. mu is a mass-ratio = 1.9970156677443420... and it's exactly
the same value in both Scilab and Fortran.<br>
</p>
<p>Most of the calculations in the output vector are OK, but in
particular around the resonance frequency, I can list the
following three datapoints (zm_star(47:49)), to show what is
worrying me:</p>
<p>In Fortran, data no. 47-48-49 (near fs):<br>
<br>
( 66.547108467527437 , -58.427426595183157 )<br>
( 105.67638116311093 ,-0.84432029182632362 )<br>
( 66.018415098214774 , 47.279402998470466 )<br>
<br>
Whereas in Scilab I get:<br>
<br>
67.58254632254881 - 57.549843258298814*%i<br>
104.56362768103634 + 0.9610187273575014*%i<br>
64.84646498264745 + 47.01680213507681*%i</p>
<p>In particular the imaginary part is different at the middle data
point (near fs) where from Fortran the value is negative, whereas
in Scilab the value is positive. It seems that the calculation of
zm_star involves some math operations that could be critical to
the precision.</p>
<p>If you study the impedance magnitude (pythagoras...), the results
from Fortran are about 1% higher in value - IMHO that's
non-negligible.</p>
<p>Studying the Nyquist circle plot of the data, it seems to me that
in general the Fortran calculation is more correct.</p>
<p>What is going wrong with the Scilab equation? Please let me know
if you have any ideas how to increase the precision of the
calculation. Thanks.</p>
<p>P.S. I'm using Scilab 5.5.0 (64 bit, Windows 10). Could it be the
Intel Math Kernel that's doing this wrong?<br>
</p>
<p>/Claus<br>
</p>
</body>
</html>