Introduction to Mathematics with Maple

It is not our aim to expound Maple programming. However, some examples can be well illuminated by exposing the entire structure of the computation by a Maple program. So we give here the mere rudiments of Maple programming, just what we need in these examples.
One occasion when readers might find it profitable to write their own program is when they need to carry out the same operation [1] many times. A Maple procedure starts with its name, followed by the assignment operator:=, the word proc and parameters to be operated on, enclosed in parenthesis. Hence it looks like
Wide choice is allowed for the parameters. They can be integers, real or complex numbers, polynomials or even sets. You must end the procedure either with end proc: or end proc;. [2] The semicolon is better: Maple comes back and prints the procedure or gives an error message. The program itself consists of commands operating on the parameters, each individual command ending with a; character or a: character.
The symmetric difference of two sets is the set which contain all elements which lie in one of the sets but not in both. Our first procedure computes symmetric difference of two sets.
> sdiff: =proc(A, B)> (A union B) minus (A intersect B);> end proc;
Let us test our program
> A:={1,2,3}; B:={2,3,4};<i class="emphasis">A</i> := {1, 2, 3}<i class="emphasis">B</i> := {2, 3, 4}> sdiff(A,B);{1, 4}