On Oct 17, 7:51 am, schaefer...@gmail.com wrote:

Just to clarify what I'm after:

If you plot (-3)^n where n is a set of negative real numbers between 0

and -20 for example, then you get a discontinuos line due to the

problem mentioned above with fractional exponents. However, you can

compute what the correct absolute value of the the missing points

should be (see z2 above for an example), but I would like to know how

to determine what the correct sign of z2 should be so that it fits the

graph.

As Roy said, a math newsgroup may be able to help you better, as you

seem to be having fundamental issues with imaginary numbers. The

imaginary part isn't an artifact of computing (-3+0j)**(-4.5), it is

an integral part of the answer. Without the imaginary part, the

result is very, very incorrect.

Actually, the graph result of (-3)^n is not necessarily discontinuous

at the intervals you specified. You just need to graph the result

with the proper number of dimensions. If you want to plot the results

of (-3)^n for n=0 to -20, you need to make a three dimensional graph,

a two dimensional graph with two sets of lines, or a circular graph

with labeled values of n.

Complex numbers can be viewed as having a magnitude and a rotation in

the real/imaginary plane. This is called polar form. Complex numbers

can also be represented using a Cartesian form, which is how Python

displays complex numbers.

Python's complex numbers allow you to extract the real or imaginary

part separately, via the "real" and "imag" attributes. To convert to

polar form, you'll need to use the abs built-in to retrieve the

magnitude, and math.atan2 to retrieve the angle. (Remember that the

imaginary part is considered the Y-axis component.)

Depending on what you're doing, you might need the real part or the

magnitude. It sounds a little bit like you're trying to represent

something as a flatlander when you should be in Spaceland. (http://

en.wikipedia.org/wiki/Flatland)

--Jason