Another relationship of variables

AI Thread Summary
The discussion focuses on programming a software to align pictures on a 2D plane, specifically determining the relationship between the variables I (picture index), C (column), and R (row). The user initially proposes formulas for C and R but struggles with the correct calculation for R. Other participants suggest corrections, clarifying that C can be calculated using the integer part of (I - 1) divided by 5, and R can be derived by subtracting the product of (C - 1) and 5 from I. The user ultimately realizes the solution is simpler than anticipated, expressing gratitude for the assistance. The conversation highlights the importance of precise calculations in programming for layout alignment.
eNathan
Messages
351
Reaction score
2
Yet again, I am programming a software to align pictures on a 2D plane, kinda like they are in windows exploror. I need to find a relationship betwen these.

I C R
_______
1 1 1
2 1 2
3 1 3
4 1 4
5 1 5
6 1 1
7 2 2
8 2 3
9 2 4
10 2 5
11 3 1

I would be my for loop counter, C would be the colum of picture I, and R would be what row it belongs to.

I already know that
C = Ceil(i / 5);
And I have come close to finding the value of R, so far I have
R = i - (Floor(i/(5 + C))*5);
But I know the latter equation is wrong, I just can't seem to figure it out out.

Thanks in advanve :smile:
 
Mathematics news on Phys.org
eNathan said:
...6 1 1
7 2 2
8 2 3
Are you sure 6 1 1? I think it should read 6 2 1.
C = [(I - 1) / 5] + 1. Where [...] is a function that takes the integer part before the decimal point of a real number. Ex : [1.5] = 1.
In some programming languages, you can write it as : C = Int((I - 1) / 5) + 1.
R = I - (C - 1) * 5.
Viet Dao,
 
Last edited:
VietDao29 said:
Are you sure 6 1 1? I think it should read 6 2 1.
C = [(I - 1) / 5] + 1. Where [...] is a function that takes the integer part before the decimal point of a real number. Ex : [1.5] = 1.
In some programming languages, you can write it as : C = Int((I - 1) / 5) + 1.
R = I - (C - 1) * 5.
Viet Dao,

Oh my It was soooo simple! I am speechless. Of course, just subtract from I, 5 C abount of times (and add one of course).

Thank you very much.
 
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
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...
Thread 'Imaginary Pythagorus'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Back
Top