List of points / spreadsheet view
First of all: Congratulations for releasing GeoGebra 3.2. At the moment I'm exploring the capabilities of the new spreadsheet functions, especially for exploratory data analysis.
With introducing spreadsheet view some problems arise regarding the consistency / logic of bidirectional or multidirectional representation of objects.
- Firstly: You create a list of points from cell area "A1:B12". The list of points creation seems to follow this logic: GeoGebra creates 12 points as invisible auxiliary objects (algebraic view), which are visible in geometric view as unique points and visible as a list of points as an dependent object (algebraic view).
The list is actually depending on the (auxiliary) points (If you click on "Properties" you will find a Definition like "P_1, P_2, P_3, P_4, P_5, P_6, P_7, P_8, P_9, P_{10}, P_{11},P_{12}"), rather than depending on the area of cells it was created from.
Suppose you'd like to redefine this list: The only way this can be handled is via editing its definition in the algebraic properties dialogue by manually deleting or adding points, or via algebraic list-operations.
A true bidirectional connection to the spreadsheet view would be referencing the according area within the table (e.g. "A1:B12", which is used when creating a list of numbers from spreadsheet view).
There is no easy way of redefining a list of points using spreadsheet references (e.g. add the area "A13:B20" to the list of points).
This might not seem to be a big problem at first glance, as you could use list operations (List1+List2), it is a problem if you create objects depending on that list and want to change these objects in one step by changing the original list (eg. to "A1:B20").
- Secondly you can easily combine list (of points or numbers) using "Union" or "Intersection", but why can't we have a similar command for creating the difference quantity of two sets/lists? It's quite easy to add elements to a list, but removing elements from a list is only simple, if these elements are undefined (using "RemoveUndefined"). Such functions could be very useful e.g. to manipulate best fit lines by removing sets of points that are stored within a list of points. Maybe this could be accomplished using "KeepIf[Condition, List]", but the help file doesn't point out if this function can be applied to lists of points or only to lists of numbers (the example given there is a list of numbers).
- Moreover I'd highly appreciate a function that allows for creating a list of points from two lists of numbers with the same length. An example: Suppose you have a list of (x,y) data and you want to resale x- and y-values. You could create two lists (x-values, y-values). You can easily add a number to each element in the list (list+number) or multiply each element in the list with a number (list * number). But there is no easy way of combing the resulting lists into a list of points.
Being able to do this would also fix the above problem, as you could delete the x-value of a point using "KeepIf" from the list of x-values and the y-value from the list of y-values and afterward create a new list of points.
- Lastly while it is easy to create a list of numbers, a list of points or a matrix from the spreadsheet view, I found no similar way to do it the opposite way. You can easily input a number, variable or point into the spreadsheet view, you can input a matrix, list of numbers or list of points into a single cell, but there seems to be no way of entering a matrix, list of numbers or list of points into multiple cells at once.
SetBackgroundColor command won't change the background color of a cell according to its value dynamically, it only changes its background color once.
Any other ideas?
Hello,
it appears to me that you didn't discovered the Sequence[] command yet. :)
You can create a list of points which keep reference to the spreadsheet view by combining Sequence[] and Object[]:
Sequence[(Object["A" + j], Object["B" + j]), j, 1, 15]
I would recommend creating a new tool though which is a bit more general by using the following command (list1 should be defined e.g. as "list1 = A1:B15"):
Sequence[(Element[list1, j], Element[list1, j + Length[list1] / 2]), j, 1, Length[list1] / 2]
Combining two lists of numbers into one list of points is even easier:
Sequence[(Element[list1, j], Element[list2, j]), j, 1, Length[list1]]
(If you create a tool from that command you also could use If[Length[list1] == Length[list2], Sequence[...]] to check if those lists are really equally-sized)
Hope that helped a bit :)
Florian
PS: I just wanted to put your differences-of-list command on the todo list but it's already there, so it will probably come with 3.4 ;)
This works for some part, under one condition: You must not have set the rounding accuracy to any kind of "Significant Figures", otherwise the object names will get messed up.
I tried the following modification (see example file):
I created the points individually from a column in the spreadsheet (F4:F14), then i defined a list:
RemoveUndefined[Sequence[Object["F" + (j)], j, 4, 14]]
As far as i understood that command, deleting one of the points or creating an empty cell e.g. at F7 should remove F7 from the list (as the Object[F14] would become undefined).
That simply doesn't happen: If i remove a point or delete the according cell, nothing happens, even worse: if i click on "Undo" after deleting the point/ cell value, the whole list becomes undefined.
https://ggbm.at/540641
Try it: it should work :)
We'll probably add a FillRows[ ], FillColumns[ ], FillCells[ ] commands to do this in the next version, and also maybe allow drag-n-drop from the Algebra View to the Spreadsheet. Other suggestions welcome :)
Is there a command like IsInList[List, Element] (or IsInList[List, List]) at the moment ? That's missing to my mind. :)
There are a couple of bugs in the file AnVohns attached:
Florian
But what is the syntax for comparing points to each other within the "Condition"-field?
For numbers, you could write something like:
KeepIf[x<3,1,2,3,4]
But there are no hints, what could be used for points or whether it is possible. What is e.g. the correct replacement for "x"?
As far as further suggestions go: The way you can select points for drawing a best-fit-line without prior defining a list of points would also be a really neat way for selecting points, that should be added to a new list of points from the geometry window. This together with difference sets/ list would allow for some easy ways of adjusting creating lists of points based on already defined list of points or a set of individually created points.
Edit:
Seems there are some more bugs with updating lists. I added another example.
list is the original list. It is a list which originally consisted of the points A,B,C.
x_{list} is a sequence which lists the x-values of the elements of "list".
y_{list} is a sequence which lists the y-values of the elements of "list".
Newx_{list} is defined as Union[KeepIf[x < x(D), x_{list}], KeepIf[x > x(D), x_{list}]].
I planned on using the Point "D" as an "eraser", which works so far (if the x-coordinate of a point in "list" is the same as x(D) the x-value of that point will be deleted from Newx_{list}.
Then i drew point E and manually edited it into "list", which is know defined as {A,B,C,D}. Also x_{List} and y_{List} automatically changed adding the x-value of E, but Newx_{list} still only contains of the x-values of A,B,C.
So neither KeepIf[] nor RemoveUndefined[] seem to be updating properly.
https://ggbm.at/540643
Sorry, ignore that :flushed:
You can do this already: alt-drag a rectangle around a list of points (using Select Tool) -> copies the list to the input bar
Hi
@ florian
The tool A \ B has already been created ...
http://www.geogebra.org/en/...;
That's really great!
Besides: I found a way to sort of fix my second example: The "eraser" now works, only problem is that it will erase points not only when dragged onto one point, but also will delete the points A(xa,xb) and B(xb,yb) when it is dragged upon Point C(xa,yb) or D(xb,yb) but that's no problem of GeoGebra but a logical one (see partly fixed example inside the attachment).
I'll try to enhance it using the difference tool now...
Edit:
That difference list tool you posted only seems to work for list of numbers, not for lists of points...
https://ggbm.at/540647
Yes, indeed
And it has an other disadvantage: It sorts the list it subtracts, e.g. {1,10,12,4}\{10} will become {1,4,12} rather than {1,12,4}, so it is neither a tool for subtracting lists of points nor for subtracting lists of numbers but only a tool for subtracting sets (sorted lists without duplicates), which makes it nearly useless for my purposes.
Thanks for the tip anyway.
If we are talking about improvements for the next version then I strongly agree with adding a difference operator and would like to suggest a command to replace this method:
How about an Offset[object,startRow,startCol,numRows,numCols] command that creates a list/matrix from a range of spreadsheet cells or creates a list/matrix of elements from another list/matrix?
Also, how about an improved Element command that can extract an element of a matrix or a spreadsheet cell with an optional column parameter?
Behold: I finally managed doing what i wanted with the eraser :D
It involves a lot of union / interference sets as intermediate / auxiliary lists, but it works.
Move the red circle over any given point and this point will become invisible and the best-fit-line will refit.
I suppose you could use the auxiliary lists to create a real difference operation for lists, but for today I'm done.
Thanks for all the advice so far.
https://ggbm.at/540649
Hi,
The eraser idea is very cool!
Here is a simpler way to get what you want:
https://ggbm.at/540651
The trick is to create your points inside the spreadsheet as a separate column. If you do it this way then you can create a list from the column of points that does not use auxiliary points. With an If[] command you can create points that depend on a condition ... like being close to the eraser.
That actually works like a charm, i corrected mine, so you could have empty rows in the table, see attachment. But the set operations in yours are much faster then in mine...
https://ggbm.at/540655
I agree, very cool idea :)
Here's another minor improvement - you can drag the points too. (I've used Condition to Show Object to hide the points)
https://ggbm.at/540653
While dragging data points isn't exactly what you SHOULD do when exploring real data, it's a neat feauture to see what single points can do to the fit line.
A bit more serious: in this version you can switch between 1. and 2. fit line (fit to x or fit to y).
There is no way yet to color cells in the spreadsheet using conditions (When Point X is invisible, color row 3 red)? That would be very nice, as you could see which line of data you have "erased", so if you erase a whole set of points you could look them up in the spreadsheet view and if it was real data, you could serach for a similar pattern / condition (not mathematically, but regarding to the content the data stand for) these sets of data share. That would be just something really explorative in the sense of explorative data analysis.
https://ggbm.at/540657
Here is a way to show a list of deleted points by setting values in the spreadsheet:
https://ggbm.at/540661
If you want to use the eraser to collect erased points then you need to use some javascript since Geogebra currently does not support internal scripting or any kind of accumulator.
Yes there is - dynamic color (Properties -> Advanced tab)
You have to set it for each cell (rather than a row) but it is preserved when you copy a cell.
That's not exactly what i meant, i thought of a wy to color the cells (background), rather than the text.
Besides: Some things i noticed when working with spreadsheets in different environments:
Btw.: Thanks for all you're help & extremely quick responses.
Please can you post a screenshot?
Please can you post a ggb file with this problem?
If you fix C3 then it will behave as you want.
You see? The title of each cell is repeated, whereas in windows only the values are shown.
Seems i was wrong on this one. This is just happening all the time on my vista machine (regardless of what's in the cells, i cant use the blue square to copy values, it just marks the cell area), works fine with all cells in linux (on the same machine) though. Not a big deal, since i could alway use CTRL-C, CRTL-V in Vista.
If you fix C3 then it will behave as you want.
Pardon me, what exactly do you mean with fixing C3? Even use of KeepIf or RemeoveUndefined won't fix it for me.