L2041-03 - Plotting, Summing and simple functions in Maple...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
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);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
sum: Maple sums up lists or sequences of numbers using "sum". For example, the first elements of "List" can be summed up as follows: > sum(List[i][1],i=1. .10); We note that the sum is 55. Exercise: a) Sum up the second elements of "List". b) Sum up all the elements of "List". More general uses of the "sum" function in Maple is illustrated by the following list of examples: > sum(i,i=0. .100); > sum(1/i,i=1. .100); > sum('c||i',i=0. .10); Notice the creation of a sum of unknown coefficients ci in the last example. This was achieved by use of the concatenation operation ||, and c||i is concatenated to ci. The summation evaluates the i (gives it a value), and the single quotes instructs "sum" not to evaluate the resulting concatenated coefficient ci. Concatenation Concatenation is a method in Maple for generating new names by putting together old ones. For example, if a and b are old variables, then a||b is a new variable.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/30/2009 for the course CSE 1560 taught by Professor Anetistis during the Fall '09 term at York University.

Page1 / 9

L2041-03 - Plotting, Summing and simple functions in Maple...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online