[SciPy-user] Real Array Expressed as Complex Array
Thu Jul 3 10:14:16 CDT 2008
On Thu, Jul 3, 2008 at 9:39 AM, Lorenzo Isella <email@example.com> wrote:
> Dear All,
> I am bit puzzled: I was plotting a (rather complicated) analytical
> potential for which an analytical form is available.
> When asking to print out the value of the potential at the cut-off:
> print "at the cut-off, the dimensionless potential takes the value, ",
> I got the following:
> at the cut-off, the dimensionless potential takes the value,
> Now, since the potential I am coding via a function has to be a real
> function, I checked that the real part was always zero (as it should).
I think you mean "...the *imaginary* part was always zero..."
> Since the result was that the array pot_ext_dimensionless is real, how
> comes that it is expressed as a complex array (though the imaginary
> part is always zero)?
It all depends on how you're calculating the pot_ext_dimensionless
array; clearly somewhere in there an operation makes it complex.
You'll have to show us how it's calculated.
You can always access the (real,imaginary) part of a complex array
with (pot_ext_dimensionless.real, pot_ext_dimensionless.imag)
But be careful, these arrays are not contiguous (they're a view into
the complex array). That wrinkle has bitten me before, but I can't
quite recall the circumstances. You can always make them contiguous
> It is true, however, that the potential could become complex for
> certain (physically unsound) choices of some parameters.
> Any suggestions?
> SciPy-user mailing list
More information about the SciPy-user