Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #1145

Re: (negative Value)**(-1.0) creates complex values

From Ingo Thies <ingo.thies@gmx.de>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: (negative Value)**(-1.0) creates complex values
Date 2012-05-26 10:19 +0200
Message-ID <a2bi1dFafjU1@mid.individual.net> (permalink)
References <05e72b70-4601-4c79-9102-b6ee4ad1b6f9@k5g2000vbf.googlegroups.com>

Show all headers | View raw


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

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

(negative Value)**(-1.0) creates complex values Michi <michael.boelling@gmail.com> - 2012-05-25 03:36 -0700
  Re: (negative Value)**(-1.0) creates complex values Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-05-25 20:45 +0200
    Re: (negative Value)**(-1.0) creates complex values Ingo Thies <ingo.thies@gmx.de> - 2012-05-26 10:07 +0200
      Re: (negative Value)**(-1.0) creates complex values sfeam <sfeam@users.sourceforge.net> - 2012-05-26 10:38 -0700
  Re: (negative Value)**(-1.0) creates complex values Ingo Thies <ingo.thies@gmx.de> - 2012-05-26 10:19 +0200
    Re: (negative Value)**(-1.0) creates complex values Michi <michael.boelling@gmail.com> - 2012-05-26 02:39 -0700
      Re: (negative Value)**(-1.0) creates complex values Ron Shepard <ron-shepard@NOSPAM.comcast.net> - 2012-05-26 11:42 -0500

csiph-web