problem with showing floor function

yabi100 shared this question 6 years ago
Answered

Floor function is as follows:

f(x)=0 when 0<=x<1

f(x)=1 when 1<=x<2


the equal sign in the limit is very important


Therefore in the graph for above function the right point on each segment is not included and should be shown by a hollow circle, indicating that it is not included.

And the left point on each segment should be included and it should be shown with a filled circle.

But when I draw this distinguishing is not clear.


Am I doing something wrong or this is the short come of the program

https://ggbm.at/1714631

Comments (8)

photo
1

hello

try sequence[(k+1,k),k,-20,20] then change the style of points

you can use floor(x(corner[1])) instead -20

saludos


NOTE: a point has not size so the no-points of a function are invisible

photo
1

hello

try sequence[(k+1,k),k,-20,20] then change the style of points

you can use floor(x(corner[1])) instead -20

saludos


NOTE: a point has not size so the no-points of a function are invisible


Thanks for your reply.

But I couldn't resolve my issue.

floor(x(Corner[1])) this returns -15.32 and I don't know what does it mean.

"Sequence" shows a set of numbers created by the formula provided. But I don't want to draw the points myself. I want the floor function to draw them for me.

According to your "note" it will be impossible for floor command to recognize no point in the drawing.


Any additional note is very welcomed.

photo
1

Corner is a command in ggb that yields the position of the corners of your Graphics View.

See here http://wiki.geogebra.org/en...

for further information

photo
1

Hi,


But I don't want to draw the points myself. I want the floor function to draw them for me.

this not exist in GGB.


But

you can make an approximation as follow:

- create a locus with points F' and F on the function f(x) (loc1)

- extrakt the points from locus (loc1P)

- sort the extraktet points (loc1PS)

- extract the left points (loc1PS_A)

- extract the right points (loc1PS_B)

- create point Corner_2

- implement script UpdateConstruction[] in Corner_2


i'm not sure the principle works in all cases


Raymond

https://ggbm.at/1714633

photo
1

floor(x(Corner[1])) this returns -15.32 and I don't know what does it mean.

this is not right floor() get an integer always


saludos

photo
1

Hi,


But I don't want to draw the points myself. I want the floor function to draw them for me.

this not exist in GGB.


But

you can make an approximation as follow:

- create a locus with points F' and F on the function f(x) (loc1)

- extrakt the points from locus (loc1P)

- sort the extraktet points (loc1PS)

- extract the left points (loc1PS_A)

- extract the right points (loc1PS_B)

- create point Corner_2

- implement script UpdateConstruction[] in Corner_2


i'm not sure the principle works in all cases


Raymond


Dear Rami

Thanks for your reply.

The graph you sent is what exactly what I want.

I will study the procedure you wrote to understand what it does.


Dear others

Thanks for sending the note on corner command.

photo
1

Hi,


This version is a little bit more robust, but sure not perfect.

- Locus

- Locus points

- "Vertex" (discontinuous) points of locus-points

- extract left point on horizontal segments

- extract right point on horizontal segments


Raymond

https://ggbm.at/1714637

photo
1

Hi


New solution:

- more short

- more understandable

- more exact (can be adjusted, now 1 pixel exact)


Prinziple:

Compare the y-value f(pixleN)) with f(pixleN - 1pixX).

If the differenze is biger then pixYBreak then this is a Left-Point.

For the Right-Points compare f(pixleN)) with f(pixleN + 1pixX)


pixN is the x-value of one pixel-point on GGB-windows

pixX is the x-length of one pixle

pixY is the y-length of one pixle.


Raymond

https://ggbm.at/1714645

© 2022 International GeoGebra Institute