Plotting, Summing and simple functions in Maple
Data points are often stored as a "
list
"
in Maple.
A list
is a structure of ordered elements deliminated by
square brackets
.
For example, [a,b,c,d] is a list of 4 elements a, b, c, d, ordered from the first "a" to
the last "d".
Example:
[1,2] is an ordered pair, a list with two elements, of which the first can be
considered an X-coordinate, and the second a Y-coordinate.
The elements of a list may themselves be lists.
Example:
[[1,2],[3,4],[5,6],[7,8]]
is a list of ordered pairs, each ordered pair is a list itself.
The elements of a list L can be accessed by specifying a coordinate.
For
example, L[3] is the third element of L.
>
L := [[1,2],[3,4],[5,6],[7,8]];
>
L[3];
L[2][1];
A list of ordered pairs can be plotted using "plot":
>
plot(L, style=point);
seq:
A list can be efficiently generated by using "seq" (for sequence).
Example:
>
List := [seq([i,i-1],i=1.
.10)];
Observe the outside square brackets (to make a list), and the dummy variable "i".
>
plot(List, style = point);
One can list the elements of a list with "seq":
>
seq(List[i],i=1.
.10);