I'm writing some code that uses a class called Point. Point has 2 variables that are used either as $(x, y)$ or $(r, \theta)$. At first it annoyed me to have somewhat silly variables names like var1 and var2 to denote points that are either Cartesian or polar, and now I'm simply curious about the terminology. Are there technical terms for the first and second parts of an ordered pair?
Asked
Active
Viewed 138 times
0
2Amateurs
- 41
-
1In the programming world, there's CAR and CDR. Don't know if that's much better than var1 and var2, though. :-) – Hans Lundmark Jun 01 '23 at 09:58
-
@HansLundmark Car and cdr refer to the first element and the rest of a list, respectively. I don't believe that is the same as an ordered pair. – John Douma Jun 17 '23 at 02:11
-
See https://en.wikipedia.org/wiki/Abscissa_and_ordinate – John Douma Jun 17 '23 at 02:12
-
@JohnDouma: It is indeed exactly an ordered pair (a “cons cell” in Lisp terminology). Lists in Lisp are implemented in terms of such ordered pairs, but the concept of a pair comes first. – Hans Lundmark Jun 17 '23 at 17:16
-
@HansLundmark Either way, it is not a good idea to use names like car and cdr in a modern app. Imagine that someone less than fifty is reading the code. I think first and second are much more intuitive. – John Douma Jun 17 '23 at 18:48
-
1@JohnDouma: Agreed! That's pretty much what I wrote in my first comment, wasn't it? – Hans Lundmark Jun 17 '23 at 19:45
1 Answers
2
It's fine to refer to the members $x$ and $y$ of an ordered pair $(x,y)$ as the first and second coordinates, respectively. Another term for these is $x$ (the first coordinate) is referred to as the abscissa, and $y$ (the second coordinate) as the ordinate.
Alex Ortiz
- 24,844
-
3AFAIK, abscissa and ordinate are usually reserved for the case where $x$ and $y$ refer to the standard Cartesian coordinate system. They wouldn't be used for a pair that represented polar coordinates, for example. – Robert Israel Jun 01 '23 at 03:26