Lists

From GeoGebra Manual
Revision as of 21:55, 16 June 2011 by Zbynek (talk | contribs)
Jump to: navigation, search


Using curly braces you can create a list of several objects (e. g. points, segments, circles).

Example:
  • L = {A, B, C} gives you a list consisting of three prior defined points A, B, and C.
  • L = {(0, 0), (1, 1), (2, 2)} produces a list that consists of the entered points, as well as these nameless points.
Note: By default, the elements of this list are not shown in the Graphics View.

Compare Lists of Objects

You can compare two lists of objects by using the following syntax:

  • List1 == List2: Checks if the two lists are equal and gives you true or false as a result.
  • List1 != List2: Checks if the two lists are not equal and gives you true or false as a result.

Apply Predefined Operations and Functions to Lists

If you apply operations and pre-defined functions to lists, you will always get a new list as a result.

Addition and subtraction

  • List1 + List2: Adds corresponding elements of two lists.
    Note: The two lists need to be of the same length.
  • List + Number: Adds the number to every element of the list.
  • List1 – List2: Subtracts the elements of the second list from corresponding elements of the first list.
    Note: The lists need to be of the same length.
  • List – Number: Subtracts the number from every element of the list.

Multiplication and division

  • List1 * List2: Multiplies corresponding elements of two lists.
    Note: The lists need to be of the same length. If the two lists are compatible matrices, matrix multiplication is used.
  • List * Number: Multiplies every list element with the number.
  • List1 / List2: Divides elements of the first list by corresponding elements of the second list.
    Note: The two lists need to be of the same length.
  • List / Number: Divides every list element by the number.
  • Number / List: Divides the number by every element of the list.

Other examples

  • List^2: Squares every element of the list.
  • 2^List: Creates list of powers of two with exponents from the list.
  • List1^List2: Creates list of a^b, where a and b are corresponding elements of List1 and List2.
  • sin(List): Applies the sine function to every element of the list. User defined functions can be applied the same way as well.
© 2021 International GeoGebra Institute