Re: [Pharo-project] Complex Solutions
From: "Schwab,Wilhelm K" <bschwab@anest.ufl.edu> ... On #cosH vs. #cosh, etc.,I do not like what you have done, but it's hardly cause to start a war. I would be more inclined to agree with your no-typo argument if you spelled out hyperbolic. We write cos and cosh; I see no advantage to typing cosH, which could just as easily be errant as cosh.
I don't understand your comment. "cos" and "cosh" differ in a single, lower case character. In a line of code where I expect to see "cos" but the text is actually "cosh" I would be more likely to misread the text as "cos" than if the text is "cosH". In this case the capital is distinctive. It clues the reader to the difference. [I once had a bug in a Fortran program where 1 was substituted for l (ell) but in the punch card font, it was very difficult to distinguish this].
#angle vs. #argument. The terminology of modulus and argument is heavily drilled into engineers and physisists, so I would go with that inertia vs. anything from Scheme or Lisp.
Thanks. I'll make the change.
Complex>>angle looks like it will answer zero for a value of zero?? Complex>>AFAIK, there should be no direction for a zero vector. In a way, it is splitting hairs because exact comparisons of floats are dubious, but it probably should raise an error for zero.
I'll raise an error. Zero divide? One again, thanks. -KenD
Ken, Understood about punch cards, and in fact I have some loose methods in String to avoid such hassles with hard to spot spellings. That said, I simply disagree with you on #cosh vs. #cosH. As I said, I'm not particularly invested in the outcome; I just find it cumbersome to type and to read, and despite that, would not conclude that cosH is not a typo - it would depend on the circumstances. As I said, I'm not planning any major troop movements over this one. As for the zero vector, it is hard to say. Note that a nearly zero vector is going to have a very poorly defined direction in that the result will likely be dominated by roundoff error. Often there is a better way to compute such things; a rearrangment of governing equations can make a world of difference - that's not something you can fix, it will be problem-specific how one would avoid computing the argument in tricky situations. One possible approach is to simply compute the angle the same way for all values and let under/over flow errors take care of the garbage. Another would be to raise an error. Finally, you might define #argument, #argumentIfSmall: (takes a block for the troublesome case) and #argumentIEEE to use their convetion. Something that deserves a careful look is the test for floats being close to each other. I have been supicious about that for a while, and on first glance, Dolphin seems to handle it very differently from the way Squeak does. IMHO, being different from Dolphin is cause for a good think. We shouls also see how VW handles it. Just looking at #closeTo:, it appears to "think" that 10^-4 is a good threshold, and that is questionable depending on the scales involved, and is far from the smallest float that can be reasonable represented. Bill -----Original Message----- From: pharo-project-bounces@lists.gforge.inria.fr [mailto:pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Ken Dickey Sent: Sunday, August 30, 2009 6:10 PM To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] Complex Solutions
From: "Schwab,Wilhelm K" <bschwab@anest.ufl.edu> ... On #cosH vs. #cosh, etc.,I do not like what you have done, but it's hardly cause to start a war. I would be more inclined to agree with your no-typo argument if you spelled out hyperbolic. We write cos and cosh; I see no advantage to typing cosH, which could just as easily be errant as cosh.
I don't understand your comment. "cos" and "cosh" differ in a single, lower case character. In a line of code where I expect to see "cos" but the text is actually "cosh" I would be more likely to misread the text as "cos" than if the text is "cosH". In this case the capital is distinctive. It clues the reader to the difference. [I once had a bug in a Fortran program where 1 was substituted for l (ell) but in the punch card font, it was very difficult to distinguish this].
#angle vs. #argument. The terminology of modulus and argument is heavily drilled into engineers and physisists, so I would go with that inertia vs. anything from Scheme or Lisp.
Thanks. I'll make the change.
Complex>>angle looks like it will answer zero for a value of zero?? Complex>>AFAIK, there should be no direction for a zero vector. In a way, it is splitting hairs because exact comparisons of floats are dubious, but it probably should raise an error for zero.
I'll raise an error. Zero divide? One again, thanks. -KenD _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
participants (2)
-
Ken Dickey -
Schwab,Wilhelm K