Triangle Calc: Parent Index to Child Indexes

AI Thread Summary
The discussion focuses on determining the child indexes of a parent index in a triangular structure. Each element in the triangle has children that are directly adjacent in the next row. A function is proposed to return the indexes of the children based on the parent index, with examples provided to clarify the relationships. The first element in each row corresponds to a triangular number, and the triangle root formula is discussed to find the index. The conversation emphasizes understanding the triangular structure for effective indexing.
DavidSnider
Gold Member
Messages
511
Reaction score
147
Let's say you have a triangle like:
1
2 3
4 5 6
7 8 9 10

The children of each element in the triangle are those directly adjacent on the next row. For example the children of 4 are 7 and 8. The children of 5 are 8 and 9.

Now let's say we flatten it to: [1,2,3,4,5,6,7,8,9,10]

Is there a way to compose a function that takes the index of the parent and returns a tuple containing the indexes of the children? (Assume 0 based indexes. The 1 through 10 are values, not indexes)
 
Last edited:
Mathematics news on Phys.org
Is 7 a child of 5?
 
No.

1: 2,3
2: 4,5
3: 5,6
4: 7,8
5: 8,9
6: 9,10

It's easier to picture when you draw the triangle as a pyramid shape, but I couldn't get the forum to format it that way.
 
Hi DavidSnider! :smile:

Use the CODE tag :wink:
Code:
          1
         2 3
        4 5 6
       7 8 9 10

Hint: the kth element in the nth row is parent to the kth and k+1th elements in the n+1th row, and the index of the first element in the nth row is … ? :smile:
 
Ah, thanks. I think I got it.

First element in nth row is the same as the triangle number:
\frac{n^2 + n}{2}

What I needed was the Triangle root:
\frac{-1\pm\sqrt{8n+1}}{2}

so the index would be:
n+\frac{1+\sqrt{8n + 1}}{2}
 
Last edited:
Suppose ,instead of the usual x,y coordinate system with an I basis vector along the x -axis and a corresponding j basis vector along the y-axis we instead have a different pair of basis vectors ,call them e and f along their respective axes. I have seen that this is an important subject in maths My question is what physical applications does such a model apply to? I am asking here because I have devoted quite a lot of time in the past to understanding convectors and the dual...
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...

Similar threads

Replies
24
Views
3K
Replies
4
Views
2K
Replies
2
Views
5K
Replies
27
Views
3K
Replies
4
Views
1K
Replies
2
Views
6K
Replies
21
Views
3K
Back
Top