Re: Comments on S32/Numeric#Complex

2009-12-18 Thread James Cloos
> "Doug" == Doug McNutt writes: >> Any ideas for a good name [for the angle]? Doug> In pre-computer times the angle was called the "argument". And that is still used. C99, as an example, calls the functions carg(3), cargf(3) and cargl(3), for operations on double complex, float complex and

Re: Comments on S32/Numeric#Complex

2009-12-18 Thread James Cloos
> It would be reasonable for perl6 to have .arg to match .angle. [SIGH] ☹ Obviously, I meant to say: It would be reasonable for perl6 to have .arg to match¹ .abs. 1] or to complement, perhaps? ☺ -JimC -- James Cloos OpenPGP: 1024D/ED7DAEA6

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Dave Whipp
Todd Olson wrote: At 14:54 -0500 2009-12-17, Jon Lang wrote: And really, my whole point is that the implementation details are (conceptually) the only thing that distinguishes Complex::Polar from Complex::Cartesian. All though both e^(i ¼) and e^(i 3 ¼) evaluate to -1 + 0i it is often u

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Dave Whipp
Doug McNutt wrote: my ($x, $y) = $vector «·« ( [1, 0], [0, 1] ); After a while I became resigned to the fact that dot and cross products were not what was being offered. Instead a product of two vectors was to be simply a component by component multiply that produced another "vector" of the s

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Doug McNutt
At 11:54 -0800 12/17/09, Jon Lang wrote: >> And I think there's a Math error in the 4th line: you don't need the >> components of a vector to do a dot product with that vector -- so it is just >> >> my ($x, $y) = $vector «·« ( [1, 0], [0, 1] ); > >True enough. > >> Which makes me wonder if all of

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Todd Olson
At 14:54 -0500 2009-12-17, Jon Lang wrote: >Dave Whipp wrote: >And really, my whole point is that the implementation details are >(conceptually) the only thing that distinguishes Complex::Polar from >Complex::Cartesian. All though both e^(i ¼) and e^(i 3 ¼) evaluate to -1 + 0i it is often us

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Jon Lang
Dave Whipp wrote: > Jon Lang wrote: >> >>  my ($num, $denom) = $num.^attr; # $num.WHAT == Ratio; >>  my ($mag, $phase) = Complex::Polar($z).^attr; >>  my ($re, $im) = Complex::Cartesian($z).^attr; >>  my ($x, $y) = $vector.^attr »·« ( [1, 0], [0, 1] ); > > If I'm reading this right, the .^attr is e

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Dave Whipp
Jon Lang wrote: my ($num, $denom) = $num.^attr; # $num.WHAT == Ratio; my ($mag, $phase) = Complex::Polar($z).^attr; my ($re, $im) = Complex::Cartesian($z).^attr; my ($x, $y) = $vector.^attr »·« ( [1, 0], [0, 1] ); If I'm reading this right, the .^attr is exposing implementation details

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Jon Lang
Dave Whipp wrote: > Moritz Lenz wrote: >> >> Dave Whipp wrote: >>> >>> [cut] Contrast with Rat which has both separate accessors and the "nude" >>> method (a name that could possibly be improved to avoid adult-content >>> filters) >> >> suggestions welcome. > > Attempting to generalize: what we wan

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Dave Whipp
Moritz Lenz wrote: Dave Whipp wrote: [cut] Contrast with Rat which has both separate accessors and the "nude" method (a name that could possibly be improved to avoid adult-content filters) suggestions welcome. Attempting to generalize: what we want is an operator that extracts a Seq of val

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Todd Olson
At 19:46 -0500 2009-12-16, Dave Whipp wrote: yary wrote: At 00:15 +0100 12/17/09, Moritz Lenz wrote: Not quite, .abs returns one of the polar coordinates (the magnitude), so only a method is missing that returns the angle. Any ideas for a good name? Would a method called "phi" with a un

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Todd Olson
At 17:10 -0500 2009-12-16, Dave Whipp wrote: >define the return value more formally, something like: > > our multi method polar (Complex $nim: --> [ Real $mag where 0..Inf, >Real $angle where -¼ ..^ ¼ ]) is export { ... } > In complex analysis it is often legitimate to work with numbers where th

Re: Comments on S32/Numeric#Complex

2009-12-16 Thread Brandon S. Allbery KF8NH
On Dec 16, 2009, at 19:46 , Dave Whipp wrote: yary wrote: At 00:15 +0100 12/17/09, Moritz Lenz wrote: Not quite, .abs returns one of the polar coordinates (the magnitude), so only a method is missing that returns the angle. Any ideas for a good name? Would a method called "phi" with a unicod

Re: Comments on S32/Numeric#Complex

2009-12-16 Thread Dave Whipp
yary wrote: At 00:15 +0100 12/17/09, Moritz Lenz wrote: Not quite, .abs returns one of the polar coordinates (the magnitude), so only a method is missing that returns the angle. Any ideas for a good name? Would a method called "phi" with a unicode synonym "φ" be too obtuse? Anything wrong

Re: Comments on S32/Numeric#Complex

2009-12-16 Thread Dave Whipp
Moritz Lenz wrote: our multi method polar (Complex $nim: --> [ Real $mag where 0..Inf, Real $angle where -π ..^ π ]) is export { ... } If you put this into a signature, it is checked on every call to that method and thus slows down execution. If you want a formalization that's not part of th

Re: Comments on S32/Numeric#Complex

2009-12-16 Thread yary
> At 00:15 +0100 12/17/09, Moritz Lenz wrote: >>Not quite, .abs returns one of the polar coordinates (the magnitude), so >>only a method is missing that returns the angle. >> >>Any ideas for a good name? Would a method called "phi" with a unicode synonym "φ" be too obtuse? -y

Re: Comments on S32/Numeric#Complex

2009-12-16 Thread Doug McNutt
At 00:15 +0100 12/17/09, Moritz Lenz wrote: >Not quite, .abs returns one of the polar coordinates (the magnitude), so >only a method is missing that returns the angle. > >Any ideas for a good name? In pre-computer times the angle was called the "argument". But that offers plenty of room for confu

Re: Comments on S32/Numeric#Complex

2009-12-16 Thread Moritz Lenz
Dave Whipp wrote: > The definition of the Complex type seems a little weak. A few things: > > To get the Cartesian components of the value there are two methods ("re" > and "im"). In contrast there is just one method "polar" to return the > polar components of the value Not quite, .abs returns

Re: Comments on S32/Numeric#Complex

2009-12-16 Thread Jon Lang
On Wed, Dec 16, 2009 at 2:10 PM, Dave Whipp wrote: > The definition of the Complex type seems a little weak. A few things: > > To get the Cartesian components of the value there are two methods ("re" and > "im"). In contrast there is just one method "polar" to return the polar > components of the

Comments on S32/Numeric#Complex

2009-12-16 Thread Dave Whipp
The definition of the Complex type seems a little weak. A few things: To get the Cartesian components of the value there are two methods ("re" and "im"). In contrast there is just one method "polar" to return the polar components of the value I'm not sure that this asymmetry is a good thing. C