You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(2) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(3) |
Feb
(1) |
Mar
(2) |
Apr
(22) |
May
(52) |
Jun
(43) |
Jul
(36) |
Aug
(59) |
Sep
(37) |
Oct
(55) |
Nov
(39) |
Dec
(36) |
| 2005 |
Jan
(64) |
Feb
(40) |
Mar
(62) |
Apr
(58) |
May
(256) |
Jun
(77) |
Jul
(80) |
Aug
(39) |
Sep
(56) |
Oct
(36) |
Nov
(113) |
Dec
(68) |
| 2006 |
Jan
(43) |
Feb
(64) |
Mar
(69) |
Apr
(60) |
May
(71) |
Jun
(53) |
Jul
(63) |
Aug
(63) |
Sep
(76) |
Oct
(85) |
Nov
(82) |
Dec
(73) |
| 2007 |
Jan
(75) |
Feb
(82) |
Mar
(84) |
Apr
(104) |
May
(67) |
Jun
(101) |
Jul
(107) |
Aug
(138) |
Sep
(128) |
Oct
(106) |
Nov
(112) |
Dec
(112) |
| 2008 |
Jan
(94) |
Feb
(87) |
Mar
(146) |
Apr
(169) |
May
(75) |
Jun
(26) |
Jul
(26) |
Aug
(7) |
Sep
(18) |
Oct
(53) |
Nov
(42) |
Dec
(19) |
| 2009 |
Jan
(43) |
Feb
(39) |
Mar
(18) |
Apr
(45) |
May
(66) |
Jun
(87) |
Jul
(56) |
Aug
(41) |
Sep
(56) |
Oct
(139) |
Nov
(98) |
Dec
(88) |
| 2010 |
Jan
(81) |
Feb
(79) |
Mar
(83) |
Apr
(97) |
May
(124) |
Jun
(84) |
Jul
(53) |
Aug
(85) |
Sep
(89) |
Oct
(50) |
Nov
(98) |
Dec
(78) |
| 2011 |
Jan
(97) |
Feb
(74) |
Mar
(68) |
Apr
(54) |
May
(63) |
Jun
(59) |
Jul
(65) |
Aug
(58) |
Sep
(37) |
Oct
(40) |
Nov
(59) |
Dec
(35) |
| 2012 |
Jan
(16) |
Feb
(56) |
Mar
(63) |
Apr
(25) |
May
(48) |
Jun
(58) |
Jul
(20) |
Aug
(13) |
Sep
(43) |
Oct
(35) |
Nov
(20) |
Dec
(17) |
| 2013 |
Jan
(22) |
Feb
(11) |
Mar
(51) |
Apr
(34) |
May
(57) |
Jun
(27) |
Jul
(70) |
Aug
(30) |
Sep
(38) |
Oct
(53) |
Nov
(40) |
Dec
(25) |
| 2014 |
Jan
(26) |
Feb
(35) |
Mar
(60) |
Apr
(12) |
May
(17) |
Jun
(15) |
Jul
(9) |
Aug
(18) |
Sep
(46) |
Oct
(18) |
Nov
(19) |
Dec
(15) |
| 2015 |
Jan
(17) |
Feb
(28) |
Mar
(21) |
Apr
(54) |
May
(36) |
Jun
(8) |
Jul
(30) |
Aug
(13) |
Sep
(3) |
Oct
(28) |
Nov
(3) |
Dec
(3) |
| 2016 |
Jan
(11) |
Feb
(9) |
Mar
(29) |
Apr
(10) |
May
(8) |
Jun
(5) |
Jul
(50) |
Aug
(57) |
Sep
(13) |
Oct
(5) |
Nov
(17) |
Dec
(11) |
| 2017 |
Jan
(3) |
Feb
(23) |
Mar
(16) |
Apr
(7) |
May
(15) |
Jun
(12) |
Jul
(48) |
Aug
(15) |
Sep
(3) |
Oct
(20) |
Nov
(28) |
Dec
(21) |
| 2018 |
Jan
(13) |
Feb
(21) |
Mar
(21) |
Apr
(7) |
May
(3) |
Jun
(7) |
Jul
(27) |
Aug
(38) |
Sep
(4) |
Oct
(30) |
Nov
(22) |
Dec
|
| 2019 |
Jan
(5) |
Feb
(16) |
Mar
(1) |
Apr
(9) |
May
(7) |
Jun
(20) |
Jul
(13) |
Aug
(3) |
Sep
(2) |
Oct
(2) |
Nov
(2) |
Dec
(4) |
| 2020 |
Jan
(6) |
Feb
(11) |
Mar
(1) |
Apr
(18) |
May
(4) |
Jun
(5) |
Jul
(12) |
Aug
(1) |
Sep
(3) |
Oct
(7) |
Nov
(1) |
Dec
(17) |
| 2021 |
Jan
(1) |
Feb
(11) |
Mar
(16) |
Apr
(6) |
May
(5) |
Jun
(1) |
Jul
(1) |
Aug
(2) |
Sep
(8) |
Oct
(10) |
Nov
(4) |
Dec
(4) |
| 2022 |
Jan
(9) |
Feb
(35) |
Mar
(4) |
Apr
|
May
(3) |
Jun
(49) |
Jul
(11) |
Aug
|
Sep
(5) |
Oct
(2) |
Nov
(16) |
Dec
(13) |
| 2023 |
Jan
|
Feb
(8) |
Mar
(3) |
Apr
|
May
(8) |
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(2) |
| 2024 |
Jan
(6) |
Feb
(9) |
Mar
|
Apr
(26) |
May
(24) |
Jun
|
Jul
(4) |
Aug
(2) |
Sep
(1) |
Oct
(10) |
Nov
(9) |
Dec
|
| 2025 |
Jan
|
Feb
(22) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(4) |
| 2026 |
Jan
|
Feb
(24) |
Mar
(20) |
Apr
(18) |
May
(2) |
Jun
(2) |
Jul
(2) |
Aug
(3) |
Sep
(6) |
Oct
(3) |
Nov
(2) |
Dec
|
|
From: Nunzio L. <nun...@gm...> - 2017-12-07 01:08:31
|
Hi, thanks for your reply and sorry I wasn't clear enough. I wish to know if there is any way to scale dash lengths other than dl as a terminal option. I would like to use, say, the same dash type but different dash length for some functions (or arrows or whatever) in the same plot. Is that more clear? Best, N Il 6 dic 2017 21:49, "theozh" <th...@gm...> ha scritto: I'm not sure whether I understand your question correctly. A single line with different dash lengths along this line? Probably, you're not looking for something like: plot x*x dashtype ". - _ " So, what should the dash length depend on? The x- or y-value or some tabulated values? ------------------------------------------------------------ ------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ gnuplot-info mailing list gnu...@li... Membership management via: https://lists.sourceforge.net/ lists/listinfo/gnuplot-info |
|
From: theozh <th...@gm...> - 2017-12-06 20:49:22
|
I'm not sure whether I understand your question correctly. A single line with different dash lengths along this line? Probably, you're not looking for something like: plot x*x dashtype ". - _ " So, what should the dash length depend on? The x- or y-value or some tabulated values? |
|
From: Hans-Bernhard B. <HBB...@t-...> - 2017-12-02 17:35:26
|
Am 28.11.2017 um 00:34 schrieb Dan via gnuplot-info:
> - in the variables L and M, the values l and m of the L and M
> parameters respectively, which, among all the (L,M) pairs that the
> Marquardt-Levenberg algorithm has tried, produce the lowest value of
> the \chi^2 statistic;
Yes.
> - in the variable FIT_WSSR, the value \Chi^2 of the \chi^2 statistic
> that is achieved by setting L = l and M = m;
Yes.
> - in the variable L_err, the value (presumably calculated in a
> finite-difference way) of
> \sqrt{\frac{2}{\left(\partial\!^{2}\!\left(\chi^2\right)/\partial
> L\!^{2}\right)_{L = l,M =
> m}-\left(\left(\partial\!^{2}\!\left(\chi^2\right)/\left(\partial\!\!L\!\partial\!\!M\right)\right)_{L
> = l,M = m}\right)^2/\left(\partial\!^{2}\!\left(\chi^2\right)/\partial
> M\!^{2}\right)_{L = l,M = m}}}
The algorithm never actually computes it just like that. What actually
happens is that the code builds a matrix of all the second partial
derivatives of \chi^2 with resepect to the given parameters. This
matrix is inverted, to yield the covariance matrix. The roots of the
diagonal elements of that matrix form the error values. These get
divided out of each column and row, to form the correlation matrix that
is printed out.
For the special case of just two parameters the formulae you found may
well be correct... I didn't compute it through to check one way or the
other.
There's really nothing special about that method. It's basically the
definition of what all fitting tools do for asymptotic error estimation.
They're "asymptotic" because they're derived from the second
derivatives, i.e. just lowest-order term describing the shape of the
\chi^2 function "landscape" near the discovered minimum, which is only
truly accurate asymptotically close to the point of evaluation.
If memory serves, the non-asymptotic approach would try to actually
trace the contour of \chi^2 at a value of <minimum> + 1, instead.
|
|
From: BBands <bb...@gm...> - 2017-12-02 00:02:39
|
Probably not what you want, but I preprocess the data in VisualBasic or
Python and then pass just the data to be plotted to gnuplot.
Best,
John
On Fri, Dec 1, 2017 at 3:26 PM, theozh <th...@gm...> wrote:
> still nobody has an idea...?
>
> Well, since the construct
> plot $Data u 1:2 every ::-1::-1
> does not exist... here is an ugly workaround (see below).
> It basically reverses a dataset and plots the first datapoint of each
> datablock.
> Maybe someone else might find it useful or even knows a better and more
> elegant way to achieve this.
> If it can be done easier using awk, gawk, sed, etc. please let me know how.
> But the following is a pure gnuplot solution.
>
> ### plot the last point of each datablock
> reset
> $Data <<EOD
> 11 1
> 22 4
> 33 9
>
> 44 16
> 55 25
> 66 36
> 77 49
>
> 88 64
> 99 81
> 110 100
> 121 121
> 132 144
> EOD
>
> print $Data
> stats $Data
> print STATS_records # number of datapoints
>
> array A[STATS_records] # helper array
> array B[STATS_records] # helper array
> array C[STATS_records] # helper array
>
> # puttig the dataset into arrays
> set table $Data2
> plot $Data u (A[$0+1]=column(-1),column(-1)):(B[$0+1]=$1,$1):(C[$0+1]=$2,$2)
> with table
> unset table
> print $Data2
>
> # reverse the dataset
> set print $Data3
> G = A[STATS_records] # initialize block indicator
> do for [i=STATS_records:1:-1] {
> if (A[i] != G) { print "" } # if different insert empty line / start
> new block
> G = A[i]
> print sprintf("%g %g", B[i], C[i])
> }
> set print
> print $Data3
>
> # plot the original values
> set key top left
> plot $Data u 1:2 w lp
>
> # plot the first datapoints of each datablock of the reversed dataset
> replot $Data3 u 1:2 every ::0::0 w p pt 6 ps 3 t "last point of each
> datablock"
>
> ### end gnuplot code
>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> gnuplot-info mailing list
> gnu...@li...
> Membership management via: https://lists.sourceforge.net/
> lists/listinfo/gnuplot-info
>
|
|
From: theozh <th...@gm...> - 2017-12-01 23:27:02
|
still nobody has an idea...?
Well, since the construct
plot $Data u 1:2 every ::-1::-1
does not exist... here is an ugly workaround (see below).
It basically reverses a dataset and plots the first datapoint of each datablock.
Maybe someone else might find it useful or even knows a better and more elegant way to achieve this.
If it can be done easier using awk, gawk, sed, etc. please let me know how.
But the following is a pure gnuplot solution.
### plot the last point of each datablock
reset
$Data <<EOD
11 1
22 4
33 9
44 16
55 25
66 36
77 49
88 64
99 81
110 100
121 121
132 144
EOD
print $Data
stats $Data
print STATS_records # number of datapoints
array A[STATS_records] # helper array
array B[STATS_records] # helper array
array C[STATS_records] # helper array
# puttig the dataset into arrays
set table $Data2
plot $Data u (A[$0+1]=column(-1),column(-1)):(B[$0+1]=$1,$1):(C[$0+1]=$2,$2) with table
unset table
print $Data2
# reverse the dataset
set print $Data3
G = A[STATS_records] # initialize block indicator
do for [i=STATS_records:1:-1] {
if (A[i] != G) { print "" } # if different insert empty line / start new block
G = A[i]
print sprintf("%g %g", B[i], C[i])
}
set print
print $Data3
# plot the original values
set key top left
plot $Data u 1:2 w lp
# plot the first datapoints of each datablock of the reversed dataset
replot $Data3 u 1:2 every ::0::0 w p pt 6 ps 3 t "last point of each datablock"
### end gnuplot code
|
|
From: Nunzio L. <nun...@gm...> - 2017-11-29 11:33:31
|
Hi all, is it possible in the latest versions of gnuplot to set a different dash length for a single line? If that is not the case, did anyone find a workaround for that? best, Nunzio |
|
From: Dan <vi5...@ya...> - 2017-11-27 23:55:14
|
> Am 20.11.2017 um 16:32 schrieb Daniel Hatton via gnuplot-info:
>
>> Please can anyone confirm whether I've correctly assessed what the fit
>> routine is putting in those output variables?
On Tue, 21 Nov 2017, Hans-Bernhard Bröker wrote:
> Not from those Unicode jungles I can't, sorry.
Thanks for trying, Hans-Bernhard. I'll try and say the same things in
LaTeX, then...
Let's say that I have run
set fit noerrorscaling
set fit errorvariables
set fit covariancevariables
fit some_equation(L,M,x) 'some_data_set.dat' using ($1):($3):($2):($4)
errors x,z via L,M
where some_equation(L,M,x) is a theoretical formula, with adjustable
parameters L and M, which is supposed to predict the quantity in the
third column of the data file, when the value of the quantity in the
first column of the data file is x; the second column of the data file
contains the standard uncertainties in the measured values in the
first column of the data file 'some_data_set.dat'; and the fourth
column of the data file contains the standard uncertainties in the
measured values in the third column of the data file
'some_data_set.dat'.
Then I _think_ I expect to find:
- in the variables L and M, the values l and m of the L and M
parameters respectively, which, among all the (L,M) pairs that the
Marquardt-Levenberg algorithm has tried, produce the lowest value of
the \chi^2 statistic;
- in the variable FIT_WSSR, the value \Chi^2 of the \chi^2 statistic
that is achieved by setting L = l and M = m;
- in the variable L_err, the value (presumably calculated in a
finite-difference way) of
\sqrt{\frac{2}{\left(\partial\!^{2}\!\left(\chi^2\right)/\partial L\!^{2}\right)_{L = l,M = m}-\left(\left(\partial\!^{2}\!\left(\chi^2\right)/\left(\partial\!\!L\!\partial\!\!M\right)\right)_{L = l,M = m}\right)^2/\left(\partial\!^{2}\!\left(\chi^2\right)/\partial M\!^{2}\right)_{L = l,M = m}}}
- in the variable M_err, the value (presumably calculated in a
finite-difference way) of
\sqrt{\frac{2}{\left(\partial\!^{2}\!\left(\chi^2\right)/\partial M\!^{2}\right)_{L = l,M = m}-\left(\left(\partial\!^{2}\!\left(\chi^2\right)/\left(\partial\!\!L\!\partial\!\!M\right)\right)_{L = l,M = m}\right)^2/\left(\partial\!^{2}\!\left(\chi^2\right)/\partial L\!^{2}\right)_{L = l,M = m}}}
- in the variable FIT_COV_M_L, the value (presumably calculated in a
finite-difference way) of
\frac{2\left(\partial\!^{2}\!\left(\chi^2\right)/\left(\partial\!\!L\!\partial\!\!M\right)\right)_{L = l,M = m}}{\left(\partial\!^{2}\!\left(\chi^2\right)/\partial L\!^{2}\right)_{L = l,M = m}\left(\partial\!^{2}\!\left(\chi^2\right)/\partial M\!^{2}\right)_{L = l,M = m}-\left(\left(\partial\!^{2}\!\left(\chi^2\right)/\left(\partial\!\!L\!\partial\!\!M\right)\right)_{L = l,M = m}\right)^2}
Please can anyone confirm whether I've correctly assessed what the fit
routine is putting in those output variables?
> Had you found and considered the documentation under "help
> statistical_overview"?
I've now had a look, but it doesn't tell me any more than the manual
did.
> You can rest assured that no Bayesian-style reasoning whatsoever was
> used in the design or implementation of this function. This is
> strictly classical statistics and optimization theory, assuming
> normal-distributed inputs etc.
OK... but irrespective of whether the author of the relevant section
of the manual (and of "help statistical_overview") was a Bayesian or a
frequentist, his/her use of the word 'asymptotic' (in 'asymptotic
standard error') strongly suggests that s/he has seen a relevant
integral approximated using Laplace's method. What I'm after is a
reference to a published source where that Laplace's method
approximation to a relevant integral took place. (A Bayesian would
have had a subtly different integrand from a frequentist, but in many
ways, the real magic is that I'd expect the leading-order Laplace's
method approximation to the Bayesian's integral to be exactly the same
as the leading-order Laplace's method approximation to the
frequentist's integral.)
Thanks again.
--
Kind regards,
Dan
|
|
From: theozh <th...@gm...> - 2017-11-24 19:19:43
|
In the following simplified dataset I just want to plot the last point of each block, here: 7, 4, 1. How can I do that? Isn't there anything like: plot $Data u 0:1 every ::-1::-1 $Data <<EOD 9 8 7 6 5 4 3 2 1 EOD # With the following: stats $Data using 1 plot $Data index STATS_blocks-1 w lp I could plot the complete last block (3,2,1), but ONLY if there were 2 empty lines between the blocks. But I need to plot the last point of each block, i.e. 7, 4, 1 |
|
From: Hans-Bernhard B. <HBB...@t-...> - 2017-11-21 18:45:02
|
Am 20.11.2017 um 16:32 schrieb Daniel Hatton via gnuplot-info: > Please can anyone confirm whether I've correctly assessed what the fit > routine is putting in those output variables? Not from those Unicode jungles I can't, sorry. Had you found and considered the documentation under "help statistical_overview"? > As an aside, I believe the following two statements to be true when > this least-squares fitting process is done in a Bayesian framework: [...] You can rest assured that no Bayesian-style reasoning whatsoever was used in the design or implementation of this function. This is strictly classical statistics and optimization theory, assuming normal-distributed inputs etc. |
|
From: Daniel H. <vi5...@ya...> - 2017-11-20 15:36:49
|
Dear All, I find myself using Gnuplot (5.0 patchlevel 3) in teaching least-squares fitting in a Bayesian framework. As such, I need to know some of the details of how the various outputs from the fit command are defined. >From a mixture of reading the manual and experimenting with running various commands, I've come to the following tentative view of what's happening: Let's say that I have run set fit noerrorscaling set fit errorvariables set fit covariancevariables fit some_equation(L,M,x) 'some_data_set.dat' using ($1):($3):($2):($4) errors x,z via L,M where some_equation(L,M,x) is a theoretical formula, with adjustable parameters L and M, which is supposed to predict the quantity in the third column of the data file, when the value of the quantity in the first column of the data file is x; the second column of the data file contains the standard uncertainties in the measured values in the first column of the data file 'some_data_set.dat'; and the fourth column of the data file contains the standard uncertainties in the measured values in the third column of the data file 'some_data_set.dat'. Then I _think_ I expect to find (with apologies if my Unicode equations don't display correctly): - in the variables L and M, the values l and m of the L and M parameters respectively, which, among all the (L,M) pairs that the Marquardt-Levenberg algorithm has tried, produce the lowest value of the χ statistic; - in the variable FIT_WSSR, the value Χ of the χ statistic that is achieved by setting L = l and M = m; - in the variable L_err, the value (presumably calculated in a finite-difference way) of √(2/((∂(χ)/∂L)ₗ¸ₘ-((∂(χ)/(∂L∂M))ₗ¸ₘ)/(∂(χ)/∂M)ₗ¸ₘ)); - in the variable M_err, the value (presumably calculated in a finite-difference way) of √(2/((∂(χ)/∂M)ₗ¸ₘ-((∂(χ)/(∂L∂M))ₗ¸ₘ)/(∂(χ)/∂L)ₗ¸ₘ)); and - in the variable FIT_COV_M_L, the value (presumably calculated in a finite-difference way) of 2(∂(χ)/(∂L∂M))ₗ¸ₘ/((∂(χ)/∂L)ₗ¸ₘ(∂(χ)/∂M)ₗ¸ₘ-((∂(χ)/(∂L∂M))ₗ¸ₘ)). Please can anyone confirm whether I've correctly assessed what the fit routine is putting in those output variables? As an aside, I believe the following two statements to be true when this least-squares fitting process is done in a Bayesian framework: - As long as the prior probability density over parameter space, evaluated at the point (L,M) = (l,m), is non-zero, the leading-order Laplace's method approximation to the standard deviation of the posterior probability distribution for L, marginalized over M, is √(2/((∂(χ)/∂L)ₗ¸ₘ-((∂(χ)/(∂L∂M))ₗ¸ₘ)/(∂(χ)/∂M)ₗ¸ₘ)). - As long as the prior probability density over parameter space, evaluated at the point (L,M) = (l,m), is non-zero, the leading-order Laplace's method approximation to the standard deviation of the posterior probability distribution for M, marginalized over L, is √(2/((∂(χ)/∂M)ₗ¸ₘ-((∂(χ)/(∂L∂M))ₗ¸ₘ)/(∂(χ)/∂L)ₗ¸ₘ)). I had to (re)invent those two statements myself, by means of an enormously long-winded derivation: I haven't seen them in any published source. However, I can't believe that I'm the first to make those statements, and I have a sneaking suspicion that the person who wrote the phrase "asymptotic standard error", both in the Gnuplot manual and in the comments of file <src/fit.c>, in the Gnuplot source code tree, _has_ seen those two statements or something very like them in a published source. If that person is on this mailing list, it'd be great if s/he could provide a reference, please. Thanks very much. -- Kind regards, Dan |
|
From: David K. <da...@gn...> - 2017-11-15 11:34:14
|
Ethan Merritt <eam...@gm...> writes: > [now I'm nit-picking...] > > Lua doesn't have integer variables, so there the question is moot. That nit, by the way, is dead. dak@lola:/usr/local/tmp/lilypond$ lua5.3 Lua 5.3.3 Copyright (C) 1994-2016 Lua.org, PUC-Rio > =math.type(4.0) float > =math.type(4) integer > -- David Kastrup |
|
From: Ethan A M. <EAM...@gm...> - 2017-11-15 02:45:34
|
On Wednesday, 15 November 2017 01:44:04 you wrote: > > > I'd say integer division is gradually becoming an anachronism, > > > and the new trend seems to be not just fixed floating-point but > > > full rational-number support or arbitrary- (even infinite-) > > > precision calculations, to avoid frustrating behaviors like > > > ceil(900e-7/12e-7) => 76. > > > > There you intrigue me. I have a patch series queued that adds 64-bit > > integer arithmetic with full overflow handling everywhere. Would it indeed > > be feasible to similarly upgrade the floating point evaluation code to > > provide more graceful handling of very large numbers? > > The int64 conversion was surprisingly easy so I can believe that > > modernizing the floating point would also be straightforward. > > But I wouldn't know where to start. Do you have suggestions? > > That particular example will "misbehave" even with 64b doubles > (or at least it did in my test, which is why I used that > particular example). It does not misbehave here in gnuplot (linux x86-64 platform) I tried a few larger exponents at random, up to ceil(900e-101/12e-101), without tripping an error. Is there some particular pattern that is prone to error? > But in general, the only reason I see not > to convert from float to double is that some platforms wouldn't > have built-in double support. Gnuplot has used (double) everywhere since 2011, when we dropped support for 16-bit Windows. The only exception is that when reading in binary matrix files, the matrix is stored as (float). I don't know why that was, but it's on my list of things to fix in 5.3 > I don't work on esoteric platforms > anymore, and obviously Win/Linux/Mac all handle double fine. Exactly. Ethan |
|
From: Tait <gnu...@t4...> - 2017-11-15 02:32:19
|
> > > > ceil(900e-7/12e-7) => 76.
> > > ...
> > That particular example will "misbehave" even with 64b doubles
> > (or at least it did in my test, which is why I used that
> > particular example).
>
> It does not misbehave here in gnuplot (linux x86-64 platform)
>
> I tried a few larger exponents at random, up to
> ceil(900e-101/12e-101), without tripping an error.
> Is there some particular pattern that is prone to error?
Sorry; I meant it misbehaves in a dumb little C++
program I was using to test, not in gnuplot.
#include <iostream>
#include <ios>
#include <iomanip>
#include <cmath>
int main() {
double num1 = 900e-7;
double num2 = 12e-7;
std::cout << std::setprecision(30) << std::fixed
<< num1 << std::endl
<< num2 << std::endl
<< num1/num2 << std::endl
<< std::ceil(num1/num2) << std::endl;
return 0;
}
Although as you say, it doesn't go to 76 in gnuplot,
which makes me wonder why it behaves differently.
|
|
From: David K. <da...@gn...> - 2017-11-15 01:48:13
|
Tait <gnu...@t4...> writes: >> > I'd say integer division is gradually becoming an anachronism, >> > and the new trend seems to be not just fixed floating-point but >> > full rational-number support or arbitrary- (even infinite-) >> > precision calculations, to avoid frustrating behaviors like >> > ceil(900e-7/12e-7) => 76. >> >> There you intrigue me. I have a patch series queued that adds 64-bit >> integer arithmetic with full overflow handling everywhere. Would it indeed >> be feasible to similarly upgrade the floating point evaluation code to >> provide more graceful handling of very large numbers? >> The int64 conversion was surprisingly easy so I can believe that >> modernizing the floating point would also be straightforward. >> But I wouldn't know where to start. Do you have suggestions? > > That particular example will "misbehave" even with 64b doubles > (or at least it did in my test, which is why I used that > particular example). But in general, the only reason I see not > to convert from float to double is that some platforms wouldn't > have built-in double support. Since historically double had been the _only_ floating point _expression_ format in K&R C (as opposed to floating point storage format that could be just float), platforms without built-in double support would be really peculiar once using them for C became a mainstream choice. -- David Kastrup |
|
From: Tait <gnu...@t4...> - 2017-11-15 01:42:55
|
> > I'd say integer division is gradually becoming an anachronism, > > and the new trend seems to be not just fixed floating-point but > > full rational-number support or arbitrary- (even infinite-) > > precision calculations, to avoid frustrating behaviors like > > ceil(900e-7/12e-7) => 76. > > There you intrigue me. I have a patch series queued that adds 64-bit > integer arithmetic with full overflow handling everywhere. Would it indeed > be feasible to similarly upgrade the floating point evaluation code to > provide more graceful handling of very large numbers? > The int64 conversion was surprisingly easy so I can believe that > modernizing the floating point would also be straightforward. > But I wouldn't know where to start. Do you have suggestions? That particular example will "misbehave" even with 64b doubles (or at least it did in my test, which is why I used that particular example). But in general, the only reason I see not to convert from float to double is that some platforms wouldn't have built-in double support. I don't work on esoteric platforms anymore, and obviously Win/Linux/Mac all handle double fine. |
|
From: Ethan M. <eam...@gm...> - 2017-11-15 01:03:29
|
On Tue, Nov 14, 2017 at 4:38 PM, Tait <gnu...@t4...> wrote:
>
> It's worth mentioning that Python has changed this behavior. In
> Python2, division defaults to integer-division and 1/2 is 0.
> Starting with Python3 (which in my experience is used everywhere
> except niche applications by now) "true" division applies,
> meaning types are auto-promoted such that 1/2 is 0.5.
>
My experience differs. I have seen hardly a sign of Python3.
Then again, probably every single application in my field counts as "niche".
Either way I really, really don't think we want to use Python as a guide.
I'd say integer division is gradually becoming an anachronism,
> and the new trend seems to be not just fixed floating-point but
> full rational-number support or arbitrary- (even infinite-)
> precision calculations, to avoid frustrating behaviors like
> ceil(900e-7/12e-7) => 76.
>
There you intrigue me. I have a patch series queued that adds 64-bit
integer arithmetic with full overflow handling everywhere. Would it indeed
be feasible to similarly upgrade the floating point evaluation code to
provide more graceful handling of very large numbers?
The int64 conversion was surprisingly easy so I can believe that
modernizing the floating point would also be straightforward.
But I wouldn't know where to start. Do you have suggestions?
Ethan
|
|
From: Tait <gnu...@t4...> - 2017-11-15 00:37:07
|
> >> as described in gnuplot help, gnuplot does integer divison if the > >> dividend and the divisors are integers. > >> As a normal user, you don't expect this > > > > [shrug] integer division is "normal" for most programming and > > scripting languages. > > Octave: 0.50000 > Guile: 1/2 > awk: 0.5 > Perl: 0.5 > Lua: 0.5 > Python: 0 > bc: 0 > Bash: 0 > Pascal: 0.5 > Fortran: 0 > > Now I'll grant you Fortran and Python. The rest either gives 0.5 or is > not intended for floating point calculations anyway. > > Arguably Octave is the most relevantly similar in scope. It's worth mentioning that Python has changed this behavior. In Python2, division defaults to integer-division and 1/2 is 0. Starting with Python3 (which in my experience is used everywhere except niche applications by now) "true" division applies, meaning types are auto-promoted such that 1/2 is 0.5. I'd say integer division is gradually becoming an anachronism, and the new trend seems to be not just fixed floating-point but full rational-number support or arbitrary- (even infinite-) precision calculations, to avoid frustrating behaviors like ceil(900e-7/12e-7) => 76. |
|
From: David K. <da...@gn...> - 2017-11-15 00:06:20
|
Ethan Merritt <eam...@gm...> writes: > On Tue, Nov 14, 2017 at 3:13 PM, David Kastrup <da...@gn...> wrote: > >> Ethan Merritt <eam...@gm...> writes: >> >> > On Tue, Nov 14, 2017 at 1:39 PM, theozh <th...@gm...> wrote: >> >> as described in gnuplot help, gnuplot does integer divison if the >> >> dividend and the divisors are integers. >> >> As a normal user, you don't expect this >> > >> > [shrug] integer division is "normal" for most programming and >> > scripting languages. >> >> Octave: 0.50000 > > Guile: 1/2 >> awk: 0.5 >> Perl: 0.5 >> Lua: 0.5 >> Python: 0 >> bc: 0 >> Bash: 0 >> Pascal: 0.5 >> Fortran: 0 >> >> Now I'll grant you Fortran and Python. The rest either gives 0.5 or is >> not intended for floating point calculations anyway. >> > > You left out the most relevant of all. > Gnuplot is written in C and uses C language code for internal and > user-visible evaluations. The implementation is completely irrelevant for the semantics (most scripting languages are implemented in C), and Gnuplot has operators like ** eq ne . > [now I'm nit-picking...] > > Lua doesn't have integer variables, so there the question is moot. Uh what? Octave does not have integer variables either because it is intended for numerical work. As is Gnuplot. Really, it's completely irrelevant what Gnuplot is implemented in. The question is what its application domain is. The user has nothing to gain from getting some technical analogy to the implementation language as an explanation for tripping him up. C is prone to crashes due to its memory access and allocation semantics, but that does not mean that it's Gnuplot's duty to give the user ways to crash the machine. At any rate, we are talking about decisions that have managed to stick around for decades, similar to % only being permitted for integers, as if there never was a need to, say, wrap a value in the 0..2pi domain or even calculate 420.5 % 360 for the sake of degrees. The main reason appears to me to rub the users' noses in the programmers' superior knowledge of C semantics. Gnuplot does not use a C parser so there is no inherent reason to prescribe C semantics. -- David Kastrup |
|
From: Ethan M. <eam...@gm...> - 2017-11-14 23:43:00
|
On Tue, Nov 14, 2017 at 3:13 PM, David Kastrup <da...@gn...> wrote: > Ethan Merritt <eam...@gm...> writes: > > > On Tue, Nov 14, 2017 at 1:39 PM, theozh <th...@gm...> wrote: > >> as described in gnuplot help, gnuplot does integer divison if the > >> dividend and the divisors are integers. > >> As a normal user, you don't expect this > > > > [shrug] integer division is "normal" for most programming and > > scripting languages. > > Octave: 0.50000 Guile: 1/2 > awk: 0.5 > Perl: 0.5 > Lua: 0.5 > Python: 0 > bc: 0 > Bash: 0 > Pascal: 0.5 > Fortran: 0 > > Now I'll grant you Fortran and Python. The rest either gives 0.5 or is > not intended for floating point calculations anyway. > You left out the most relevant of all. Gnuplot is written in C and uses C language code for internal and user-visible evaluations. [now I'm nit-picking...] Lua doesn't have integer variables, so there the question is moot. Ruby: stonelion [186] ruby print 1/2, "\n" 0 Ethan > Arguably Octave is the most relevantly similar in scope. > > -- > David Kastrup > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > Membership management via: https://lists.sourceforge.net/ > lists/listinfo/gnuplot-info > |
|
From: David K. <da...@gn...> - 2017-11-14 23:15:34
|
Ethan Merritt <eam...@gm...> writes: > Pascal (ah nostalgia...) it's been years. I no longer remember, and I > don't have a Pascal > compiler on my current machines to try it. Pascal has "div" and "mod" operators if you want integer results. -- David Kastrup |
|
From: David K. <da...@gn...> - 2017-11-14 23:13:43
|
Ethan Merritt <eam...@gm...> writes: > On Tue, Nov 14, 2017 at 1:39 PM, theozh <th...@gm...> wrote: >> as described in gnuplot help, gnuplot does integer divison if the >> dividend and the divisors are integers. >> As a normal user, you don't expect this > > [shrug] integer division is "normal" for most programming and > scripting languages. Octave: 0.50000 Guile: 1/2 awk: 0.5 Perl: 0.5 Lua: 0.5 Python: 0 bc: 0 Bash: 0 Pascal: 0.5 Fortran: 0 Now I'll grant you Fortran and Python. The rest either gives 0.5 or is not intended for floating point calculations anyway. Arguably Octave is the most relevantly similar in scope. -- David Kastrup |
|
From: Ethan M. <eam...@gm...> - 2017-11-14 23:07:35
|
On Tue, Nov 14, 2017 at 2:19 PM, theozh <th...@gm...> wrote: > Thanks Ethan, > I knew the int() function but didn't know about the real() function. I thought this is for extracting the real part of complex numbers, but obviously it can also be used to convert an integer number to a real number. > >> [shrug] integer division is "normal" for most programming and >> scripting languages. > [ahem]... then the few languages I know a little bit (Perl, Python, Pascal,... ) are not "normal" ;-) I think you are mis-remembering > stonelion [163] python > Python 2.7.13 (default, Jan 28 2017, 17:29:29) > [GCC 5.4.0] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> print 5/2 > 2 > >>> > > Perl being perl, you have your choice :-) Although it is true that perl defaults to floating division, it is recommended to place the "use integer" pragma at the start of any program that cares. stonelion [164] perl > use integer; > print 5/2, "\n"; > 2 > > Pascal (ah nostalgia...) it's been years. I no longer remember, and I don't have a Pascal compiler on my current machines to try it. > What worries me a bit is: > Quote help: > "The result of division of a negative integer by a positive one may vary among compilers. Try a test like "print -5/2" to determine if your system chooses -2 or -3 as the answer." I suspect that statement dates all the way back to 1980something, and refers to compilers or computer architectures from last century. C99 compliance guarantees truncation towards zero. (But C89 did not, so yes at the time gnuplot was first written it made sense to worry about this). As a side note - people contributing code to gnuplot recently often assume that use of C99 features is OK. We may want to require use of a C99 compliant complier in the future, but so far the gnuplot coding guidelines and installation instructions don't say that. If we add that caveat for 5.3, I will remove the caution you point to in the docs. > Well, as long as I am working only on my system I should know what I will get ;-). Anyhow, using real(variable) will force floating point arithmetic if you need that. |
|
From: theozh <th...@gm...> - 2017-11-14 22:20:01
|
Thanks Ethan, I knew the int() function but didn't know about the real() function. I thought this is for extracting the real part of complex numbers, but obviously it can also be used to convert an integer number to a real number. > [shrug] integer division is "normal" for most programming and > scripting languages. [ahem]... then the few languages I know a little bit (Perl, Python, Pascal,... ) are not "normal" ;-) What worries me a bit is: Quote help: "The result of division of a negative integer by a positive one may vary among compilers. Try a test like "print -5/2" to determine if your system chooses -2 or -3 as the answer." Well, as long as I am working only on my system I should know what I will get ;-). |
|
From: Ethan M. <eam...@gm...> - 2017-11-14 21:56:04
|
On Tue, Nov 14, 2017 at 1:39 PM, theozh <th...@gm...> wrote:
> as described in gnuplot help, gnuplot does integer divison if the dividend and the divisors are integers.
> As a normal user, you don't expect this
[shrug] integer division is "normal" for most programming and
scripting languages.
> and you will learn about this "pitfall" when you're wondering why you get wrong plotting results (or if you read the manual from the beginning to the end and will stumble across it).
>
> How to force a floating point division with two integer variables, e.g. in loops?
If you need to force a variable to be a real number, use real(var).
Conversely if you need an integer, use int(var).
> The only way I found is to multiply the first number by 1.0
> Is this really the way to go?
>
> Example:
>
> do for [i=1:6] {
> do for [j=1:6] { print sprintf("%g\t%g",i/j,i*1./j) }
> }
>
> Isn't there maybe a way to set a flag to always use floating point divison?
print real(i) / real(j)
Ethan
|
|
From: theozh <th...@gm...> - 2017-11-14 21:39:40
|
as described in gnuplot help, gnuplot does integer divison if the dividend and the divisors are integers.
As a normal user, you don't expect this and you will learn about this "pitfall" when you're wondering why you get wrong plotting results (or if you read the manual from the beginning to the end and will stumble across it).
How to force a floating point division with two integer variables, e.g. in loops?
The only way I found is to multiply the first number by 1.0
Is this really the way to go?
Example:
do for [i=1:6] {
do for [j=1:6] { print sprintf("%g\t%g",i/j,i*1./j) }
}
Isn't there maybe a way to set a flag to always use floating point divison?
|