|
From: Ethan M. <merritt@u.washington.edu> - 2008-01-22 22:41:29
|
On Tuesday 22 January 2008 14:30, Mojca Miklavec wrote: > On Jan 22, 2008 11:20 PM, Ethan Merritt wrote: > > On Tuesday 22 January 2008 05:54, Daniel Heiserer wrote: > > > I would like to add some functions to the CVS version of gnuplot. > > > These functions include: > > > min() > > > max() > > > std() > > > mean() > > > etc. > > Could you explain why you need to have these as built-in functions? > > What is wrong with just defining them yourself: > > > > min(A,B) = A < B ? A : B > > > > You can put that definition in your customization file ~/.gnuplot > > if you always like to have it. > > I agree that min, max, mean and others might be handy to have. I > always "hack them" with ($1+$2+$3+$4)/4 or the way you have just > shown, but these are really basic functions that are often used and > easy to implement. The two argument case is trivial, as shown above. The general case of N arguments would be less trivial, particularly if you are looking for a way to make the calculation over an arbitrary number of data points read from a data file. Before jumping in with both feet, I think it would be useful to block out what exactly is the goal. I can understand wanting MIN and MAX for simple bookkeeping, for example choosing which of two column values to use. But the need for a command line std(a,b,c,...) or mean(a,b,c,...) function is not obvious to me. This seems more like something one would track automatically during the course of data input than something one would type in manually at the command line. > Instead of asking "why one would want to add them", I would rather ask > "why not". The reason to ask "why" is that there may be a better way to achieve the actual goal. -- Ethan A Merritt |