Index numbers vs. Quantity in a group

Click For Summary

Discussion Overview

The discussion revolves around the concept of quantity in a group versus quantity in an indexed group, particularly in the context of programming and mathematical notation. Participants explore the implications of indexing in arrays and the associated counting methods, including the potential for errors in counting.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant describes the difference between counting items in a group (e.g., apples) and counting indexed items in programming, noting the need to add 1 when calculating quantities from indices.
  • Another participant introduces the term "fence-post error" to describe the counting method where the number of elements is calculated as n - m + 1, providing an example to illustrate this concept.
  • A later reply references the "off-by-one error" (OBOE) as a related concept, linking it to broader confusion in counting, such as the relationship between years and centuries.

Areas of Agreement / Disagreement

Participants generally agree on the terminology and concepts related to counting in indexed groups, although there is no explicit consensus on the educational background regarding these concepts.

Contextual Notes

The discussion highlights a potential gap in educational curricula regarding counting methods in programming and mathematics, as well as the nuances of indexing that may not be covered in earlier education.

Who May Find This Useful

Individuals interested in programming, computer science, mathematics, and those exploring concepts related to counting and indexing in data structures may find this discussion relevant.

1plus1is10
Messages
51
Reaction score
0
"Quantity in a group"
If you have 6 apples and you subtract 4, then you have 2 apples left "in the group".

"Quantity in an Indexed group"
I'm a computer programmer - I manipulate arrays of data (a.k.a. matrix)
In a math formula format: x1, x2, x3... xn
(as a side note - in a computer format: x[0], x[1], x[2]... x[n-1])
If I want the "quantity" from 6 to 4, then I always have to add 1 (6-4=2, 2+1=3 quantity)
Quantity of 3: x4, x5, x6

Surprisingly, I was never taught this in grade school or high school.
Not to mention I always thought it had to do with the fact that a computer's array starts with index 0: x[0]
(It doesn't, although that fact adds confusion when turning math formulas into code)

My question is: Does this "add 1" scenario have a mathematical name?
(I've been trying to Google about it to add a note/comment to my code to explain "+1" without sounding stupid)

Thanks
 
Mathematics news on Phys.org
1plus1is10 said:
"Quantity in a group"
If you have 6 apples and you subtract 4, then you have 2 apples left "in the group".

"Quantity in an Indexed group"
I'm a computer programmer - I manipulate arrays of data (a.k.a. matrix)
In a math formula format: x1, x2, x3... xn
(as a side note - in a computer format: x[0], x[1], x[2]... x[n-1])
If I want the "quantity" from 6 to 4, then I always have to add 1 (6-4=2, 2+1=3 quantity)
Quantity of 3: x4, x5, x6

Surprisingly, I was never taught this in grade school or high school.
Not to mention I always thought it had to do with the fact that a computer's array starts with index 0: x[0]
(It doesn't, although that fact adds confusion when turning math formulas into code)

My question is: Does this "add 1" scenario have a mathematical name?
(I've been trying to Google about it to add a note/comment to my code to explain "+1" without sounding stupid)

Thanks
The closest I can come up with for a name is when you miscount -- a "fence-post" error. The number of elements in the range ##x_m## through ##x_n##, inclusive, with ##n \ge m##, is n - m + 1. For example, the number of elements in the range ##x_3## through ##x_7##, again inclusive, is 7 - 3 + 1 = 5. They are ##x_3, x_4, x_5, x_6, x_7##. This type of counting typically isn't taught in grade school or high school (that I am aware of), but it is taught in basic computer science classes, or possibly in probability and statistics courses.
 
  • Like
Likes   Reactions: jbriggs444 and 1plus1is10
Wow again...
This also explains the age-old problem/confusion with year/century (e.g. the 1900's is the 20th century).
Cool man.
 

Similar threads

  • · Replies 48 ·
2
Replies
48
Views
5K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 24 ·
Replies
24
Views
3K
  • · Replies 26 ·
Replies
26
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 17 ·
Replies
17
Views
4K