> # this is a comment line.if you read this, then you have successfully started your session, congratulations!!!

 > # I recommend you use ctrl-3 to adjust the font size. Better? yeah!

 > 1+1;

 > # hey, we can compute 1+1, great.

 > %+1;

 > # the % stands for the latest result, so you don't have to type it again, that's nice

 > %+1;

 > # note that = is test for equality, not assignment

 > x = 3;

 > # the := is used to assign something to something # in this case, we assign the value 3 to x.

 > x := 3;

 > # now x has the value 3;

 > x;

 > # test for equality:

 > x = 3;

 > # how can we get rid of the assignment? # well we need to unassign it, here is how this is done:

 > x := 'x';

 > x;

 > # that's right, now x is a symbol without a value.

 > x := 4;

 > # there's another way to get rid of all assigned variables,

 > # it is a complete memory clear:

 > restart;

 > x;

 > # OK, now everything is fresh again. # let's move on.

 > #guess what, we are going to do some fractions, yeah!

 > 1/3;

 > 0.333333;

 > # 1/3 and 0.333333 is not the same thing, so get used to it!

 > # however, if you want to treat 1/3 as floating point number, # you can give evalf on it.

 > evalf(1/3);

 > # you can have more digits if you like:

 > evalf(1/3,100);

 > # Maple treats mathematical quantities exact, i.e. the way mathematicians # would treat them. For applications, you may want to switch to # floating points. As we have seen, you can do that.

 > # another example is that of factorials. # n! (read n factorial) is defined as the product of all # numbers from 1 to n. For example 5! = 5 * 4 * 3 * 2 * 1 = 120:

 > 5!;

 > # Let's do 6!= 6*5*4*3*2*1 = 6 * 5! = 6 * 120 = 720

 > 6!;

 > # now let's do double factorials

 > 6!!;

 > # wow, what was that? # That was 6!! = 720! = 720 * 719 * 718 * ... * 2 * 1, # which of course is a very large number. Notice that Maple gives you # the exact answer, even though you might not have expected such a large output. # This is typical for Maple. # Now if you like, you can turn that number into a floating point. # Here, the % notation comes in handy.

 > evalf(%);

 > # Let's give it a name using the assignment operator. # Notice that it is now already the next to last result, so we # use the double percent notation:

 > a := %%:  # no output this time

 > evalf(a);

 > evalf(a,100);

 > # this was a floating point number with 100 decimal digits precision.

 > # Do you know what Pi is?

 > Pi;

 > # hmmm, maybe you were expecting 3.14... # here we go:

 > evalf(Pi);

 > #want more digits? Here we go:

 > evalf(Pi,100);

 > # OK, I hope you see the difference between a symbolic system and a numeric system. # Maple is symbolic, Matlab is numeric, for example.

 > # let's move on.

 > restart;

 >

 >

 >

 > #uhh adding fractions, let Maple do it:

 > 1/3+1/5;

 > # that was correct! 1/3 + 1/5 = 5/15 + 3/15 = 8/15.

 > 1/%;

 > # now we want powers, this is how we do it:

 > 2^2;

 > #more powers:

 > 2^3;

 > 2^4;

 > # want more? why not have a little loop? guess what, Maple starts counting from 1 (I repeat: one)

 > for i to 10 do 2^i; end;

 > # you can do whatever you want inside the loop.

 > # lets say you want to compute 2^i - 1

 > for i to 10 do 2^i - 1; end;

 > # now we want to start the loop from i=2. # this is how we do it.

 > for i from 2 to 10 do 2^i; end;

 > # notice that the output starts with 2^2 = 4 rather that 2^1 = 2.

 > # I want a sequence. Notice the assign operator :=

 > seq1 := 1,2,3;

 > #another one:

 > seq2 := 4,5,6;

 > #let's concatenate the sequences:

 > seq3 := seq1,seq2;

 > #let's access elements of the sequence, for example the third:

 > seq3[3];

 > # uhh, don't access the zeroth element, this is Maple and not C, OK!?

 > seq3[0];

Error, invalid subscript selector

 > #let's make the sequence longer:

 > seq3 := seq3,7,8,9;

 > #how long is it?

 > length(seq3);

 > # well, that can't be right. In fact you must use nops and square brackets, don't ask why at this point

 > nops([seq3]);

 > # OK let's add more stuff:

 > seq3 := seq3,a,b,c;

 > nops([seq3]);

 > # you have noticed that we always have a semicolon at the end of a command.

 > # we can also have a colon. That would then suppress output, as follows:

 > seq3:=seq3,d,e,f:

 > # want to see seq3 ?, here you go:

 > seq3;

 > # lets make a sequence of the first few powers of 2:

 > S := seq( 2^i, i=1..10);

 > # we could also do it this way:

 > S := seq( 2^i, i={1,2,3,4,5,6,7,8,9,10});

 > # let's learn how to use lists!

 > # a list is just a sequence put into square brackets

 > L := [1,2,3,4,5];

 > # access goes from 1 to 5:

 > L[1];

 > L[2];

 > L[3];

 > L[4];

 > L[5];

 > # we can change an entry in the list using the assignment operator :=

 > L[1] := 2;

 > L;

 > # how can we append? # Our first guess is this

 > L := [L,6];

 > # hmm, that was't what we wanted.

 > # here is the solution. Let's first restore L:

 > L := [1,2,3,4,5];

 > # its a bit tricky, we need to get the contents # of the list first, and then add one more entry and # make it a list, such as

 > op(L); #the content of the list, as a sequence:

 > [op(L),6]; #now we add an element and make another list:

 > # we can have a loop create a list as long as we wish:

 > for i from 1 to 10 do  L := [ op(L), i ]: end;

 > # uhh, what was that. # That was one line of output for each execution of the # loop body.

 > # Maybe that is too much output for you. # turning the ";" to a ":" after the end prohibits output:

 > L := []: for i from 1 to 10 do  L := [ op(L), i ]: end:

 > L;

 > # there is a quick way to generate repeated elements in lists # for example 0\$10 would generate 10 entries 0

 > L := [3\$7]; # seven 3's

 >

 >

 >