Thomas Bellman <[EMAIL PROTECTED]> wrote:
> Alex Martelli <[EMAIL PROTECTED]> wrote:
>
> > C has no stand on complex numbers.
>
> If by that you mean that C does not have complex numbers, then
> you are wrong. C99 defines the three types float _Complex,
> double _Complex, and long double _Compl
Alex Martelli <[EMAIL PROTECTED]> wrote:
> C has no stand on complex numbers.
If by that you mean that C does not have complex numbers, then
you are wrong. C99 defines the three types float _Complex,
double _Complex, and long double _Complex, and also the header
.
--
Thomas Bellman, Lysator
Tim Peters wrote:
> [Robert Kern]
>
>>...
>>ph3 = math.atan( ac3.imag / ac3.real )
>>...
>
> Don't do that: atan2 is the correct way to compute the angle, because
> the signs of both inputs are needed to determine the correct quadrant.
> So do:
>
> ph3 = math.atan2(ac3.imag, ac3.real)
Roy Smith wrote:
> In article <[EMAIL PROTECTED]>, Sambo <[EMAIL PROTECTED]>
> wrote:
>
>
>>I have the following module:
>>---
>>import math
>>
>>def ac_add_a_ph( amp1, ph1, amp2, ph2 ):
>>
>>amp3 = 0.0
>>ph3 = 0.0
>>ac1 = ( 0, 0j )
>>ac2 = ( 0, 0j )
[Roy Smith]
> I certainly agree about using atan2() instead of atan(), but I'm surprised
> there's not an easier way to get the phase of a complex, just like abs()
> gives you the modulus. I can see why you wouldn't want to pollute the
> global namespace with another built-in just for this purpose
In article <[EMAIL PROTECTED]>,
"Tim Peters" <[EMAIL PROTECTED]> wrote:
> [Robert Kern]
> > ...
> > ph3 = math.atan( ac3.imag / ac3.real )
> > ...
>
> Don't do that: atan2 is the correct way to compute the angle, because
> the signs of both inputs are needed to determine the correct quadran
[Robert Kern]
> ...
> ph3 = math.atan( ac3.imag / ac3.real )
> ...
Don't do that: atan2 is the correct way to compute the angle, because
the signs of both inputs are needed to determine the correct quadrant.
So do:
ph3 = math.atan2(ac3.imag, ac3.real)
instead.
--
http://mail.python.o
Em Sáb, 2006-04-22 às 15:14 -0400, Sambo escreveu:
> when I import it (electronics) in python.exe in windows2000 and
> try to use it, it croaks. ???
$ python2.4
Python 2.4.3 (#2, Mar 30 2006, 21:52:26)
[GCC 4.0.3 (Debian 4.0.3-1)] on linux2
Type "help", "copyright", "credits" or "license" for m
Sambo wrote:
> I have the following module:
> ---
> import math
>
> def ac_add_a_ph( amp1, ph1, amp2, ph2 ):
>
> amp3 = 0.0
> ph3 = 0.0
> ac1 = ( 0, 0j )
> ac2 = ( 0, 0j )
> ac3 = ( 0, 0j )
>
Sambo <[EMAIL PROTECTED]> wrote:
> I have the following module:
> ---
> import math
>
> def ac_add_a_ph( amp1, ph1, amp2, ph2 ):
>
> amp3 = 0.0
> ph3 = 0.0
> ac1 = ( 0, 0j )
> ac2 = ( 0, 0j )
> ac3 = ( 0, 0j )
You're defining ac1, ac2, ac3 as tup
In article <[EMAIL PROTECTED]>, Sambo <[EMAIL PROTECTED]>
wrote:
> I have the following module:
> ---
> import math
>
> def ac_add_a_ph( amp1, ph1, amp2, ph2 ):
>
> amp3 = 0.0
> ph3 = 0.0
> ac1 = ( 0, 0j )
> ac2 = ( 0, 0j )
I have the following module:
---
import math
def ac_add_a_ph( amp1, ph1, amp2, ph2 ):
amp3 = 0.0
ph3 = 0.0
ac1 = ( 0, 0j )
ac2 = ( 0, 0j )
ac3 = ( 0, 0j )
ac1 = complex( amp1 * math.cos( mat
12 matches
Mail list logo