Path: csiph.com!news.mixmin.net!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Karl Ratzsch Newsgroups: comp.graphics.apps.gnuplot Subject: Re: consistency of function .vs. data plotting Date: Mon, 25 Jun 2018 16:06:02 +0200 Organization: solani.org Lines: 36 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: solani.org 1529935563 25016 127.0.0.43 (25 Jun 2018 14:06:03 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Mon, 25 Jun 2018 14:06:03 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 In-Reply-To: Content-Language: en-GB Cancel-Lock: sha1:kgYj2otpjE17z6E9NAzIMrANKv0= X-User-ID: eJwFwQEBACAIA7BK4n/UOIDYP4Kb4Oa16HLq6dmGTgLGLtsj7lHNlMlWz4gEk2iIo9yb8QEHXBCJ Xref: csiph.com comp.graphics.apps.gnuplot:3974 Am 19.06.2018 um 18:41 schrieb palme@kapott.org: > But the approach using the pseudo data file plots also points for the complex results outside the [-1,1] range. > > See yourself: > print "using pure function" > plot asin(x) > pause -1 "press enter" > print "using pseudo data file" > plot '+' using 1:(asin($1)) with lines > pause -1 "press enter" > > So I have two questions: > > 1) Where exactly is my misunderstanding of the documentation, regarding the way how data file plotting works in comparison to plotting pure functions? > > 2) How can I avoid these complex results to be plotted with the second approach? gnuplot does not internally report complex values as _undefined_ in data plots, but does so in function plots. That's imo just a bug. Of course a data plot containing non-real values makes no real sense, and you can't even directly read in complex values from a data file, because there is no predefined format for them. set sample 11 set table plot "+" us 1:(1/$1) # 1/0 _is_ reported as undefined plot "+" us 1:(sqrt($1)) # sqrt of negative values isn't As a workaround, you could do sth like following f(x) = ... plot "+" us 1:(imag(f(x) =0 ? f(x) : NaN)