|
From:
<br...@ph...> - 2006-05-28 12:04:22
|
Daniel J Sebald wrote: > I've been tweaking the examples in prob.dem to be a little more accurate > and mathematically correct visually. And it occurs to me that it might > be nice for gnuplot to handle discontinuities in an elegant way. Would be nice if it were actually possible, but it isn't. Seriously. The only way for gnuplot to distinguish a true discontinuity from a mere fast variation in a plotted function would be to add a full analytical maths engine. And that's before you consider that for data plots the whole concept of continuity doesn't exist in the first place. If people want an analytic maths engine that understands calculus, I hope they'll know where to find MuPAD, Maple, Mathematica or something like them. > But on second thought, why shouldn't a plotting program be able to > leave out the line connecting the left and right limits of a > discontinuity? Because it can't really know whether that's discontinuity or not. > The only problem is choosing the plot range and samples correctly so > that the discontinuity ends up being selected. No. The problem is that tuning of equidistant sampling can typically only be done to match *one* discontinuity --- but there's no way of telling how many discontinuities a plotted function might have in the plotted range, or where they'll be. > OK, well, then here is something else that would make plotting > discontinuities a little nicer. Say f(x) is defined as above > > f(x) = x<1?0:1/x > > and I were able to plot subranges in my plot > > plot [x=-1:1-epsilon] f(x) with lines lc rgb "red", [x=1+epsilon:4] f(x) > with lines lc rgb "red" You *are* able to do that, once you switch to parametric mode. set parametric set trange [0:1-epsilon] x1(t)=-1+2*t x2(t)=1+3*t plot x1(t),f(x1(t)), x2(t), f(x2(t)) > the plotting process 1-epsilon is basically cast to 1.0. (BTW, why does > putting the range in the plot override the "set xrange [#,#]" command? Because that's what _all_ optional elements of a 'plot' command do, in gnuplot: they override whatever the default for some property of the plot might be. 'with <style>' overrides 'set style function' or 'set style data', 'linetype <n>' overrides the colour, and a range overrides the corresponding 'set *range'. |