Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ingo Thies Newsgroups: comp.graphics.apps.gnuplot Subject: Re: (negative Value)**(-1.0) creates complex values Date: Sat, 26 May 2012 10:19:56 +0200 Lines: 30 Message-ID: References: <05e72b70-4601-4c79-9102-b6ee4ad1b6f9@k5g2000vbf.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net Cg3qr73wP3Wi9Tl7Pir23gw505W1FaP2IbyYXexX7DqPqtcKGOMX+mEwoGJCvecCCB Cancel-Lock: sha1:6Y7Ky4zgpvyBRAAFDQS6vCKxpUg= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: <05e72b70-4601-4c79-9102-b6ee4ad1b6f9@k5g2000vbf.googlegroups.com> Xref: csiph.com comp.graphics.apps.gnuplot:1145 Am 2012-05-25 12:36, schrieb Michi: > Is there a way to prevent gnuplot from generating complex numbers for > (negative Value)**(-1.0) and similar cases. > Here an example what I mean: > > gnuplot> print (-1)**(-1) > -1.0 > gnuplot> print (-1)**(-1.0) > {-1.0, -1.22460635382238e-016} Well, is there any good reason not to use integer exponents (i.e. without the decimal dot)? If, however, you are using a variable as exponent which may also have non-integer values, for which the result is necessarily non-real, the only way to force a real result for integer-valued exponents would be some trap condition: If the exponent is integar-valued, it should be treated as an integer resp. the imaginary part should be treated as zero. Or just use the real part only, if you never expect any non-real result. Just for clarification of terms: Any real number is by definition also a complex one (just with zero imaginary part), just as natural numbers are also a real, or like humans are also animals. But as not every animal is a human (e.g. cats are non-human animals), similarly, not every complex number is a real number. With "non-real number" I mean a number which has a non-zero imaginary part, like the one on your second print example. Best wishes, Ingo