![]() |
|
|
|||||||
![]() |
Python - Re: trouble with complex numbers |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
>>>>> Christian Heimes <> (CH) wrote:
>CH> You can write your own phase() function. This function is mostly correct >CH> unless either the real and/or the imag part is NaN or INF. >CH> from math import atan2 >CH> def phase(z): >CH> z += 1j # convert int, long, float to complex That should be z += 0j >CH> return atan2(z.imag, z.real) -- Piet van Oostrum <> URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: Piet van Oostrum |
|
|
|
|
#2 |
|
Posts: n/a
|
Piet van Oostrum <p...@cs.uu.nl> wrote:
> That should be z += 0j Pardon my ignorance, but could anyone explain the rationale behind using 'j' to indicate the imaginary number (as opposed to the more intuitive 'i')? (Not that I've had much call to use complex numbers but I'm curious....) alex23 |
|
|
|
#3 |
|
Posts: n/a
|
On Aug 6, 1:18*am, Scott David Daniels <Scott.Dani...@Acm.Org> wrote:
> I think it explained in the complex math area, but basically EE types > use j, math types use i for exactly the same thing. *Since i is so > frequently and index in CS, and there is another strong convention, > why not let the EE types win? That 'i' tends to be used as index did occur to me, I just wasn't aware of what conventions were used in other contexts. Thanks, Scott, much appreciated. alex23 |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| DVD Verdict reviews: GHOST IN THE SHELL: STAND ALONE COMPLEX: 2ND GIG (VOLUME 3) and more! | DVD Verdict | DVD Video | 0 | 03-09-2006 09:22 AM |
| DVD Verdict reviews: GHOST IN THE SHELL: STAND ALONE COMPLEX: 2ND GIG (VOLUME 2) and more! | DVD Verdict | DVD Video | 0 | 01-19-2006 09:34 AM |
| Re: Numbers and more numbers... | Linda | A+ Certification | 1 | 12-03-2005 12:43 AM |
| Re: Numbers and more numbers... | Breedo | A+ Certification | 0 | 12-02-2005 12:45 AM |
| Re: Laptop won't type numbers | Adam Leinss | A+ Certification | 2 | 06-09-2005 04:00 AM |