3. The math block is child's play
As shown in the figure, the blocks are composed of elements, which are
the work unit with blocks.
1 element = 1 unit
With the elements, we can create rows or columns.
The row is a set of horizontally grouped elements.
The column is a set of grouped elements vertically.
Grouping rows or columns, formed surfaces or levels.
If we combine various levels, we get a block.
The Dimensions
Some science fiction movies with space matters, almost always tend to
say this in one or another dimension
We define the dimensions 1D, 2D, 3D, 4D, 5D and 6D ....
1D is formed by rows or columns of elements.
2D: this consists of rows and columns of elements.
3D: This consists of rows and columns, grouped into levels or layers.
4. 4D: consists of several blocks, 3D grouped in rows.
5D: consists of several blocks, 3D grouped in rows and columns.
6D: consists of several blocks, 3D grouped in rows and columns, and
levels.
5. Linking blocks would form on 7D, 8D, 9D, etc, etc ..
These three figures are equivalent, all have 27 elements. Can transform
the various ways (dimensions, blocks, 1D, 2D, 3D ...) different, but still
have the same elements, they are all equivalent, keep the same number
of elements.
6. The concepts
In this work, the positions of the elements, rows, columns, and levels,
will count as follows:
Rows, columns, or blocks Levels and Dimensions
1 = Rows, always up and down.
2 = Columns, always from left to right
3 = Levels, always from top to bottom.
4 = Blocks or dimensions, from left to right and top to bottom.
A very important observation:
"The number of rows <= the number of columns."
Were it otherwise, these calculations would be wrong
7. Calculation of positions
Data released:
Block data unit:
FU = Number of rows of the block unit
CU = Number of columns of the block unit
NU = Number of block unit levels
BU = number of identical blocks to the block unit
The data of the position of the item to search:
PF = Position row
PC = Position Column
PN = Position Level
PB = Number of Block
General formula for calculating the position of the item to search =
((PF - 1) * CU) + PC + ((FU * CU * (NP - 1))) + ((FU * CU * NU) * (PB - 1))
This formula is the result of combining the different levels of calculation
of the position of an element, depending on the arrangement of the unit
blocks.
8. 2D
Using the general formula we can calculate the position of an element in
a table or standard 2D
Unit block data Example:
FU = 5 CU = 6 S = 1 BU = 1 elements = 5 * 6 * 1 * 1 = 30
Item data to search:
PF = 4 PC = 5 PN = 1 PB = 1
Position the element =
((PF - 1) * CU) + PC + ((FU * CU * (NP - 1))) + ((FU * CU * NU) * (PB - 1))
((4-1) * 6) + 5 + ((5 * 6 * (1-1))) + ((5 * 6 * 1) * (1-1)) = 23
We can also be calculated as follows:
2D position = ((PF - 1) * CU) + PC
Substituting values for the variables, we obtain also the position in a 2D
system:
((4-1) * 6) + 5 = 23
9. 3D
Using the general formula we can calculate the position of an element
on a level table or 3D
Unit block data Example:
FU = 3 CU = 3 NU = 3 BU = 1 Items = 3 * 3 * 3 * 1 = 27
Item data to search:
PF = 3 PC = 3 PN = 3 PB = 1
Position the element =
((PF - 1) * CU) + PC + ((FU * CU * (NP - 1))) + ((FU * CU * NU) * (PB - 1))
((3-1) * 3) + 3 + ((3 * 3 * (3-1))) + ((3 * 3 * 3) * (1-1)) = 27
We can also calculate the position as follows:
3D = position ((PF - 1) * CU) + PC + ((FU * CU * (NP - 1)))
Replacing the variables by their values, also we get the position in a 3D
system:
((3-1) * 3) + 3 + ((3 * 3 * (3-1))) = 27
10. 4D
Using the general formula we can calculate the position of an element in
a table or level 4D
Unit block data Example:
FU = 3 CU = 3 NU = 3 BU = 3 elements = 3 * 3 * 3 * 3 = 81
Item data to search:
PF = 2 PC = 2 PN = 2 PB = 3
Position the element =
((PF - 1) * CU) + PC + ((FU * CU * (NP - 1))) + ((FU * CU * NU) * (PB - 1))
((2-1) * 3) + 2 + ((3 * 3 * (2-1))) + ((3 * 3 * 3) * (3-1)) = 68
From 3D, we will always use general formula, simply must know the
number of blocks we have in the system.
11. 5D
Unit block data Example:
FU = 3 CU = 3 NU = 3 BU = 9 elements = 3 * 3 * 3 * 9 = 243
Item data to search:
PF = 1 PC = 1 PN = 1 PB = 9
Position the element =
((PF - 1) * CU) + PC + ((FU * CU * (NP - 1))) + ((FU * CU * NU) * (PB - 1))
((1 - 1) * 3) + 1 + ((3 * 3 * (1 - 1))) + ((3 * 3 * 3) * (9 - 1)) = 217
12. 6D
Unit block data Example:
FU = 3 CU = 3 NU = 3 BU = 27 elements = 3 * 3 * 3 * 9 = 729
Item data to search:
PF = 3 PC = 3 PN = 2 PB = 27
Position the element =
((PF - 1) * CU) + PC + ((FU * CU * (NP - 1))) + ((FU * CU * NU) * (PB - 1))
((3-1) * 3) + 3 + ((3 * 3 * (2-1))) + ((3 * 3 * 3) * (27-1)) = 720
13. Round the problem
In this chapter, we turn to the problem, we know the composition (rows,
columns, levels) of the block unit and the position of the element.
Now we look for the row, column, and block level indicated where the
item is located.
Psudocodes will use to calculate each stage of the process, at the end
of all processes, there is a program in Basic, which includes various
stages, to calculate the row of the item you seek.
If we make the stages sequentially, we can not calculate the partial data.
Using pseudocode, it is because they are very simple and everyone can
play her the way, as simple as possible.
These processes are general, they serve for all cases.
14. We will use this more complex example:
Data we need in this example:
F = Number of rows of the block unit = 3
C = Number of columns of the block unit = 3
N = Number of unit block levels = 3
B = Number of block search
P = Position the item to search = 683
INT = Part entire Mod = Division remainder
15. The block
Here we calculate the block where the search item.
1D calculation rule, by common sense .
2D, the level is = 1.
CALCULATE BLOCK
F = 3
C = 3
N = 3
P = 683
If P MOD (F * C * N) <> 0 Then
B = INT (P / (F * C * N)) + 1
Else
B = INT (P / (F * C * N))
End if
Write "BLOCK =" B
End
BLOCK = 26
Comment:
By common sense, if the position of the element to find, the divide
between the elements of the block unit (F * C * N), we obtain the blocks
drive that contains the element to look or in other words the position
where the item is located to search.
We note that if the remainder is "0" means that the search positions, is
on the last item in a block.
Otherwise, it is in any position other block or unit block (the first), so
the ratio we add a "1".
16. Level
CALCULATE LEVEL
F = 3
C = 3
N = 3
B = 26
P = 683
Level = INT (P / (F * C)) + 1
If P MOD (F * C) = 0 Then
Level = Level -1
Else
Level = Level
End If
K = Level - ((B-1) * N)
Write "LEVEL =" K
End
LEVEL = 1
Comment:
A level consists of rows and columns = F * C = Level.
If we divide the position we're in, between the number of elements in a
level, "P / (F * C)", we get that level we find, however, this calculation
would be as if our example was a block of 3F * 3C * 81N, if at all levels of
our system, we subtract the level where we are, "Level - ((B-1) * N)", we
get the level of a single block.
17. The column
CALCULATE COLUMN
C = 3
P = 683
If P <C then
CO = P
Else
CO = P MOD C
End If
If P MOD C = 0 Then
CO = C
Else
CO = CO
End If
Write "COLUMN =" CO
End
COLUMN = 2
Comment:
We see that if the position to seek, is less than the number of columns
of the block unit, the position of the spine to look for, is equal to the
position where we are.
If P < C then CO = P
The rest of the process is equal to the level.
18. The Row
CALCULATE ROW
F = 3
C = 3
N = 3
B = 26
P = 683
Level = INT (P / (F * C)) + 1
If P MOD (F * C) = 0 Then
Level = Level -1
Else
Level = Level
End If
N = Level <<< see comment on the level
F = INT (((P-CO-((F * C) * (N-1))) / C) +1) <<< Formula to calculate the row
Write "ROW =" F
ROW = 3
After this sequence of calculation, we get all the data, the element to
look is in:
BLOCK = 26
LEVEL = 1
COLUMN = 2
ROW = 3
19. Epilogue
You keep thinking that math block is child's play?
Which you find applications to these formulas?
Possible applications:
Informatics, Robotics, 3D Automated Storage, Cryptography, 3D
Graphics integers.
In computing, it is shown that all vector / Dim 2D, 3D, 4D ..., can be
converted into a Vector / Dim 1D.
3D storage, knowing the number of rows, columns and store levels, you
simply need to indicate the position and the program breaks down in
row number, column number and level number where the object is to
find.
3D graphics, may indicate a 3D point by a value, for example point 3 * 3
* 3, its position is 27, then decompose and get X, Y, Z (Row, Column,
Level).
In cryptography and coding coordinates, etc, etc.
For more information and to see the beginning of this work:
http://www.freebasic.net/forum/viewtopic.php?f=3&t=19820
Repository:
http://es.slideshare.net/ZkrouhnZyx/matematicas-con-bloques
To write comments
lrcvs@yahoo.es
Dedicated to all people who are curious.
20. Basic programs
Program to calculate the position of the element to find.
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::
cls
input "unit block rows ="; ro
input "unit block columns ="; co
input "unit levels block ="; it
print
input "Row Position ="; a
input "Column = Position" b
input "Position Level =" c
input "block number ="; d
P = ((a - 1) * co) + b + ((ro * co * (c - 1))) + ((* co ro * le) * (d-1))
print "position ="; p
end
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
21. Program to find the row, column, and block level where there is an
element for.
Data required:
Rows of the block unit
Columns of the unit block
Block unit levels
Position to search
:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::
cls
input "Number of rows of the block unit (rows <= columns) ="; r
input "Number of columns of the block unit (columns> = rows) =" c
input "Number of levels block unit ="; l
input "Position to seek ="; p
h = l
'Calculating block
if p mod (r * c * l) <> 0 then
d = int (p / (r * c * l)) + 1
else
d = int (p / (r * c * l))
end if
'Calculated level
l = int (p / (r * c)) + 1
if p mod (r * c) = 0 then l = l-1
'Calculated column
if p <c then a co = p
if p> = c then a co = p mod c
if mod p c = 0 then co = c
'Calculate row
f = ((p-co - ((r * c) * (l-1))) / c) +1
':::::::::::::::::::::::::::::::::
print
color 12
print "blo =" d, "fil =" f; "Col ="; co; "Lev ="; l - ((d-1) * h)
end