I find a lot of motivation from topology. If you plot a smooth degree d curve over the complex numbers, it forms a surface of degree g=(d-1)(d-2)/2. In the case of a cubic, we get genus 1, i.e. a torus. Now tori admit a very natural group action, namely addition in (R/Z)^2. And sure enough, if you pick the right homeomorphism, this corresponds to the group action given by the elliptical curve.
Of course, the homeomorphism to (R/Z)^2 does not respect the geometry (it is not conformal). If we want the map to preserve angles, we need our fundamental domain to be a parallelogram instead of a rigid square. The shape of the parallelogram depends on the coefficients of the cubic, and the isomorphism is uniquely defined up to choice of a base point O (mapping to the identity element; for elliptic curves, this is normally taken to be the point at infinity). You still get a group law on the parallelogram from vector addition in the same way, and this pulls back to the precise group action on the elliptic curve.
The real magic is that the resulting group law is algebraic, meaning that a*b can be written as an algebraic function of a and b. This means you can do the same arithmetic over any field, not just the complex numbers, and still get a group action.
Rooks don't have taxicab geometry. Their metric space is compact even on an infinite board. I think you're thinking of the wazir: https://en.wikipedia.org/wiki/Wazir_(chess)
Sure, but who's reading the conversation to determine whether it "looks suspicious"? A regex? A neural network? Who decides the algorithm, and do you really can believe they won't ever change it to serve other more nefarious purposes like suppressing dissent?
> Who decides the algorithm, and do you really can believe they won't ever change it to serve other more nefarious purposes like suppressing dissent?
YES. That's the problem. Whoever controls it has that power. We don't want that. That's the argument against ChatControl: "imagine that those who get in power are against you, and imagine what they can do if they abuse this tool".
But saying that "a law enforcement officer may see a false-positive between a parent and their child and I find this insufferable" won't convince many people, IMHO.
I am confused how we can define a rotation number of the map from S^1 to R^3 defined at the end of the second paragraph. R^3 is nullhomotopic, after all...
My preference is semi-compatible with both conventions:
First = 0
Second = 1
Toward = 2
Third = 3
…
This way, the semantic meaning of the words “first” (prior to all others) and “second” (prior to all but one) are preserved, but we get sensical indexing as well.
And when you do need google, you can always just add `!g` to your search query. There are a bunch of other useful ones [0], my favorite is probably `!w` for Wikipedia.
I disagree on the zero-based indexing complaint. Indeed, the fact that Julia indexed from 1 is the sole reason I will never use an otherwise great language. I can’t comprehend how people came to the conclusion this was a good idea.
Julia being a mostly functional non-systems-programming language, where memory addressing is usually in the background, I think you'd find you rarely use numeric-literal indexing and you were getting upset over nothing.
The typical looping over i from 1 to length(a) is not idiomatic in Julia, where looping over eachindex() or pairs() abstracts away any concern over index type (OffsetArray can have an arbitrary first index). There's firstindex() and lastindex(); bracket indexing syntax has begin and end special keywords. Multidimensional arrays have axes().
"But what about modular arithmetic to calculate 1-based indexes?"
Julia has mod1(), fld1(), etc., which also provide a hint to anyone reading the code that it might be computing things to be used as index-like objects (rather than pure arithmetic or offset computation).
The strict way to handle indexing, I suppose, would be to have distinct 1-indexed (e.g. Ind1) and 0-indexed (e.g. Ind0) Int-based types, and refuse to accept regular Ints as indexes. That would eliminate ambiguity, at the cost of Int-to-Ind[01] conversions all over the place (if one insists on using lots of numeric literals as indexes). And how would one abstract away modular arithmetic differences between the Ind0 and Ind1 types? By redefining regular mod and div for Ind1? That would be hella confusing, so that abstraction probably isn't viable.
> The strict way to handle indexing, I suppose, would be to have distinct 1-indexed (e.g. Ind1) and 0-indexed (e.g. Ind0) Int-based types, and refuse to accept regular Ints as indexes.
I would be happy if unsigned integer UInt would start indexing from 0, whereas for signed integer it would start from 1. Also a module level parameter where preference on whether a literal integer shall be interpreted as Int or UInt would alleviate many usability issues there.
It seems that a lot of programmers have trouble distinguishing between indexing and offsets.
This is probably due to legacy of C language which conflates those two, possibly for performance and simplicity reasons. Same goes for case sensitivity in programming languages, again a legacy of C...are Print, print and PRINT really different functions, is that really what you intended???
Anyway, indexing is enumerating elements and it naturally starts at 1 for the first element and goes to Count for the last.
Offsets are pointer arithmetic artifact where first element is at offset of 0 for most but not all data structures.
Then you get "modern" languages like Python where they adopt indexing from 0 (no offsets since there are no pointers) and range where start is inclusive and end is exclusive...very natural behavior there. Oh, and lets make it case sensitive so you never know if it's Print, print, PRINT...or count, Count and COUNT until you run for 20 min and then crash.
I'm confused that you're bringing in case sensitivity into the discussion. For simplicity, early systems could not be case sensitive because they didn't have a large enough character set.
The comment about crashing due to spelling error really should be addressed by some form of static analysis, not by making name lookups more relaxed, in my opinion.
You think mathematicians had it all wrong for centuries?
Incidentally, I find it amusing that in Europe, the ground floor is zero, while in the US, it's one. (A friend of mine arrived at college in the US and was told that her room was on the first floor. She asked whether there was a lift as her suitcase was quite heavy...)
> You think mathematicians had it all wrong for centuries
As a mathematician, yes, I do. Pretty much everything becomes simpler if you treat zero as the first natural number.
> Incidentally, I find it amusing that in Europe, the ground floor is zero, while in the US, it's one.
I really think it makes no sense to number the ground floor as 1. This means if you want to know the height of the nth floor, you have to multiply the height of a story by (n-1).
There are a ton of other cases where you have to needlessly subtract 1 when people use 1-based indexing. To name a few
- Dates: why did the 21st century start on 1/1/2001? Why are the 1800s the 19th century? It doesn’t make any sense. If we indexed from zero, today would be 5/0/2023 (5 months, 0 days, 2023 years since the common era), in the 20th century. It all becomes so easy and intuitive.
- Mathematical foundations: If we are using set theory to encode mathematics, how is the number 1 defined? As a set containing itself? This leads to paradoxes in many cases. As the set containing a different single element? Then we can call its contents 0.
- Musical intervals: why do two thirds (ok, major and minor, but I’ll gloss over that) make a fifth? Does 3+3=5? The fact that musical intervals index from 1 significantly increases the cognitive burden for music theory. It becomes much easier when we index from 0.
- Birthdays: Age is correctly indexed from zero, but it may seem counterintuitive that your first birthday is the day you are born. So when is your second birthday? The day you turn 1, of course. The word “third” sounds like 3, so it seems reasonable to me to introduce a new ordinal here (I like “toward”).
- Computing: languages that use 1-based indexing are obscuring what is actually going on; they generally just subtract 1 internally from the user’s input. They have to, since indexing from 0 is fundamentally more efficient at the hardware level. 4 bits can only store 15 possible addresses if you throw away 0.
These are just a few examples and by no means an exhaustive list. Conversely, I have yet to know of a single instance where 1-based indexing makes more sense or simplifies things (aside from being more compatible with legacy features of our society).
After a while, when you think deeply about it, you start to feel that 0-based indexing is something closer to a fundamental truth, rather than simply a convention. Indeed, I propose that the only reason people find 0-based indexing counterintuitive is due to social conditioning.
>I can’t comprehend how people came to the conclusion this was a good idea.
If you look at a textbook for numerical analysis likely the algorithms will be 1-indexed. Julia is a language primarily for writing down mathematics, it would be quite silly not to use mathematical conventions.
Curious whether likely is indeed correct. Certainly the textbook my numerical analysis course had wasn't because remember playing with indices to get clean Julia code.
Of course, the homeomorphism to (R/Z)^2 does not respect the geometry (it is not conformal). If we want the map to preserve angles, we need our fundamental domain to be a parallelogram instead of a rigid square. The shape of the parallelogram depends on the coefficients of the cubic, and the isomorphism is uniquely defined up to choice of a base point O (mapping to the identity element; for elliptic curves, this is normally taken to be the point at infinity). You still get a group law on the parallelogram from vector addition in the same way, and this pulls back to the precise group action on the elliptic curve.
The real magic is that the resulting group law is algebraic, meaning that a*b can be written as an algebraic function of a and b. This means you can do the same arithmetic over any field, not just the complex numbers, and still get a group action.
reply