On 3 March 2016 at 01:28, Lubomir I. Ivanov <[email protected]> wrote: > On 3 March 2016 at 00:55, Lubomir I. Ivanov <[email protected]> wrote: >> On 3 March 2016 at 00:28, Linus Torvalds <[email protected]> >> wrote: >>> Lubomir, what tool did you use for the least-square fitting? >>> >> >> those equations in particular came from this website: >> http://polynomialregression.drque.net/online.php >> >>> Because it would be interesting to see if we can do this for the table at >>> >>> http://www.baue.org/library/zfactor_table.php >> >> i can take a look a these a bit later - e.g. in 30 minutes. >> > > are those pressure values in PSI? > we want them in bars i assume, based on the previous table? > http://lists.subsurface-divelog.org/pipermail/subsurface/2016-February/024642.html >
i've used a small C program to convert the pressures here http://www.baue.org/library/zfactor_table.php from psi to bar with the 0.0689475728 coefficient and rounded the bar value to the nearest integer. i've also added the AIR calculation, just in case. one important thing to note here, since we are aren't using something like spline interpolation, but instead, using polynomial regression, deviations *can* happen near the data set edges. so for instance, the tables start at 7 bars and end at 276 bars, but if the input is 1 bar or something like 500 bars, the value might not follow the fitted curve to the data set and deviate. this is usually worse with something like Lagrangian interpolation, tolerable to quite bad with polynomial regression and pretty good with splines (but splines are expensive and i don't have a ready algorithm / website for them). -------------------------------------------------------------- oxygen: --------- bar / z 7 0.995 14 0.990 21 0.986 28 0.981 34 0.977 41 0.973 48 0.969 55 0.966 62 0.962 69 0.959 76 0.956 83 0.954 90 0.951 97 0.949 103 0.947 110 0.945 117 0.944 124 0.943 131 0.942 138 0.941 145 0.940 152 0.940 159 0.940 165 0.941 172 0.941 179 0.942 186 0.943 193 0.944 200 0.945 207 0.947 214 0.948 221 0.950 228 0.953 234 0.955 241 0.957 248 0.960 255 0.963 262 0.966 269 0.969 276 0.972 biquad: y = 1.000166641097901 - 0.0007420889598606622*x + 0.00000188569152312097*x^2 + 4.01140790998e-9*x^3 - 8.81067154e-12*x^4 quint: y = 1.0002231211532653 - 0.0007471497056767194*x + 0.00000200444854807816*x^2 + 2.91501995188e-9*x^3 - 4.48294663e-12*x^4 - 6.11529e-15*x^5 -------------------------------------------------------------- nitrogen: --------- bar / z: 7 0.998 14 0.997 21 0.995 28 0.994 34 0.993 41 0.993 48 0.993 55 0.993 62 0.993 69 0.994 76 0.995 83 0.996 90 0.997 97 0.999 103 1.001 110 1.003 117 1.005 124 1.008 131 1.011 138 1.014 145 1.017 152 1.021 159 1.024 165 1.028 172 1.032 179 1.036 186 1.041 193 1.045 200 1.050 207 1.054 214 1.059 221 1.064 228 1.069 234 1.074 241 1.080 248 1.085 255 1.091 262 1.096 269 1.102 276 1.107 biquad: y = 1.0001872105114884 - 0.00030769385613513414*x + 0.00000326995780587478*x^2 - 1.88687434484e-9*x^3 - 2.9779061e-12*x^4 quint: y = 1.0001898816185364 - 0.00030793319362077315*x + 0.00000327557417347714*x^2 - 1.93872574476e-9*x^3 - 2.7732353e-12*x^4 - 2.8921e-16*x^5 -------------------------------------------------------------- helium: bar / z: --------- 7 1.004 14 1.007 21 1.011 28 1.015 34 1.018 41 1.022 48 1.026 55 1.029 62 1.033 69 1.036 76 1.040 83 1.043 90 1.047 97 1.050 103 1.054 110 1.057 117 1.061 124 1.064 131 1.067 138 1.071 145 1.074 152 1.078 159 1.081 165 1.084 172 1.088 179 1.091 186 1.094 193 1.097 200 1.101 207 1.104 214 1.107 221 1.110 228 1.114 234 1.117 241 1.120 248 1.123 255 1.127 262 1.130 269 1.133 276 1.136 biquad: y = 0.9998885418429937 + 0.0005435539837400252*x - 2.3960530861159e-7*x^2 + 1.999279624e-10*x^3 + 6.760135e-14*x^4 quint: y = 0.9998700261301693 + 0.0005452130351730479*x - 2.7853712233619e-7*x^2 + 5.5935404211e-10*x^3 - 1.35114572e-12*x^4 + 2.00476e-15*x^5 -------------------------------------------------------------- air: bar / z 7 0.997 14 0.995 21 0.993 28 0.991 34 0.990 41 0.989 48 0.988 55 0.987 62 0.987 69 0.986 76 0.987 83 0.987 90 0.988 97 0.988 103 0.990 110 0.991 117 0.992 124 0.994 131 0.996 138 0.999 145 1.001 152 1.004 159 1.007 165 1.010 172 1.013 179 1.016 186 1.020 193 1.024 200 1.028 207 1.032 214 1.036 221 1.040 228 1.045 234 1.049 241 1.054 248 1.059 255 1.064 262 1.069 269 1.074 276 1.079 biquad: y = 0.9997260053715754 - 0.0003827060866716186*x + 0.00000279540706068042*x^2 + 2.0260744986e-10*x^3 - 5.54727693e-12*x^4 quint: y = 0.9994355774568318 - 0.00035668306234655186*x + 0.00000218474273138185*x^2 + 5.8403793405e-9*x^3 - 2.780101081e-11*x^4 + 3.144563e-14*x^5 -------------------------------------------------------------- lubomir -- _______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
