# Highlight box of grid with number?

Math123 shared this question 2 years ago

Pls ee attached. How to highlight the boxes of grid and number every single box inside the polygon and rectangle.

Files: Area.ggb

1

What you really want is unknown.

I could enumerate in minimum 16 thinkable variants.

You have to specify the problem (very much !) more precisely.

----------------

Rectangle can be rotate relative to axis?

The principle must also works for any polygon?

Mesh is parallel to sides or axis or can be rotated?

MeshSize is proportional with an integer factor to polygon-size or has absolut lengths?

MeshForm is a (square, rectangle, parallelogram, triangle etc.)?

1 Mesh (instance) must be selectable with mouse or a number in a input-box (mesh-instace with or without script)?

Number go from left to right and bottom to top (relative to axis) or something else?

1

above is updated.

And: what is the general purpose?

(for example: demonstrate the area of an rectangle with integer lengths and a 1x1 mesh)

(or for example: sample for a nested sequence() in 2D)

1

Hi rami. Yes to show the area. draw lines vertical and horizontal axes inside the rectangle. and make no of every square box and color (also possible to show different color).

1

So I assume:

The sides of rectangle are parallel to axis.

The side-length of rectangle has an integer-value and is defined with sliders.

The mesh is parallel to sides and axis and is a square with the dimension 1x1 ggb-units.

The mesh-instances are in the spreadsheet (there the properties can be changed)

The number of mesh-instances are the same as the cell-name in the spreadsheet (A1...Ann)

OK?

1

Yes. Pls make both files in one case with integer values. and another with any value just show boxes and line.

1

And what is with the 1x1 mesh in the case there are no integer-values for sides?

1

When no integer values. Pls just show mesh lines darker and highlight boxes inside the closed object.

1

This?

1

Improved version (number)

1

Thanks rami. Pls explain the use of flatten command().

1

floor(<number>) next integer in direction minor: floor(-1.2)=-2/floor(1.2)=1

Flatten(<list with lists>) = {{...}, ....{...}} delete all inner curly braces = {.........}

1

So, How it working in this way Flatten(sequence(sequence ))

1

Sequence(Sequence()) = {{...}, ....{...}}

Flatten(Sequence(Sequence()) = {..................}

https://wiki.geogebra.org/e...

1

Thanks rami. Pls also explain zip command it still not clear.

1

Zip(a+b, a, list_a, b, list_b) == Sequence(list_a(n) + list_b(n), n,1,Min(Length(list_a), Length(list_b)))

In Zip: the names a and b are only inside the Zip-command valable.

They represent 1 element from the associated (example: a,list_a) list (with the same index).

normally list_a and list_b has the same length.

1

still not clear zip command . Is it possible to explain with example and attachment a project for use of zip command in easy way.

Thank you for the support.

1

Sorry no. Read again the explanation above including the description in the manual. Then make your one sample.

• Define 2 lists l1=1..10) and l2=11..20 and add (the values) in Zip: 1+11, 2+12.....10+20
• Define 1 list l3=1..10 multiply (the values) in Zip: 1*3, 2*3 .....10*3 (Note: 3 is a constant)

1

what is the use of "n" let say "l1(n)".

what is n here.

1

n is the name for the index in Sequence(<expression>, n,1,Min(Length(list_a), Length(list_b)))

you have a free choice for this name and he is valable only inside the Sequence(). This variable is starting by the 3.parameter and increase by Step (5.parameter, default =1) until n>= 4.parameter. With each step/cycle the expression (using the variable "n") is executed and 1 element in the list is created.

1

Note: some text above updated

1

maybe a better explanation for Zip():

Zip(<expression>, <param1name>, >list1>, <param2name>, >list2>)

Internal Zip increase a counter (not visible for the programmer) from 1 to the lowest length of <list1> and <list2>. This counter is (internal) using as internal index in <list1> and <list2>.

.

One element from <list1> with the internal index is moved/associated to <param1name>. And with the same internal index from <list2> to <param2name>.

.

Note: <param1name> and <param2name> are only valable inside the Zip, the name can be freely chosen.

.

After this the <expression> is executed (using <param1name> and <param2name>) and 1 element in the new list is created.

.

Then the internal index is increased by 1 and the iteration go to next step until the internal index come to the ende of one of the 2 lists.

.

1

Note: I'm offline fore some hours.

1

Many thanks rami..!