octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: polar (i)


From: Rik
Subject: Re: polar (i)
Date: Wed, 2 Dec 2015 14:01:53 -0800

On 12/02/2015 01:03 PM, address@hidden wrote:
Subject:
Re: polar(i)
From:
Doug Stewart <address@hidden>
Date:
12/02/2015 01:03 PM
To:
Muhali <address@hidden>
CC:
octave-maintainers <address@hidden>
List-Post:
<mailto:address@hidden>
Precedence:
list
MIME-Version:
1.0
References:
<address@hidden> <address@hidden> <address@hidden> <address@hidden>
In-Reply-To:
<address@hidden>
Message-ID:
<address@hidden>
Content-Type:
multipart/alternative; boundary=089e014940e692070d0525f09c6f
Message:
7



On Wed, Dec 2, 2015 at 3:03 PM, Muhali <address@hidden> wrote:
Doug Stewart-4 wrote
> so to use polar notation of complex numbers use
>
> a=angle+mag*j

well, that IS confusing, at least for the mathematically trained eye. In the
complex plane your number a, as a complex number, would not be at (0,1) but
at (pi/2,1). It would have the "canonical" representation in polar form

arg(a) = 0.567 = "angle" ≠ pi/2
abs(a) = 1.86 = "magnitude" ≠ 1

So, whatever "angle" means in the form presently used by octave, it is not
the angle in the complex plane. What angle is it then? Or what plane?


This is not math!!! This is just a way to hold an angle and a length in a single variable.

It does not conform to any math. But you could make a function to convert it to 
a complex number.
You would have to do the following to make a Cartesian number

function ret = conv2math(a)
realpart= imag(a)*cos(real(a))
imagpart=imag(a)*sin(real(a))
ret=realpart+imagpart*i
endfunction


But it is not intended for math just to hold numbers to be plotted with polar.
I didn't invent it I just read octaves help section

Using this you can store the angle and length in a scalar.
If you use 
 q=cart2pol(1 ,+.5)
q =

   0.46365   1.11803
size(2)
1 2
 
1 row and 2 col.



I'm pretty sure Octave did not make up this weird convention, but was following Matlab's lead.  The polar plot function expects polar (theta, rho) so I think Matlab went with theta + rho*j as the way to encapsulate the two pieces of information in a single complex number.  If you look at the function compass the documentation specifically says that compass (Z) = compass (real (Z), imag (Z)).  This is in keeping with polar (Z) = polar (real (Z), imag (Z)) == polar (theta, rho).

--Rik



reply via email to

[Prev in Thread] Current Thread [Next in Thread]