Learning Mathematica Basics—Working with Lists

Solve each of the following problems using Mathematica exclusively.

1.  Form the list {1,2,3,4,5} and assign it to a variable named numbers.

2.  Form the list {a,b,c,d,e} and assign it the name letters.

3.  Extract the third element of letters by using the command letters[[3]].

4.  Extract the fifth element of letters.

5.  Join the two lists together by using the command Join[letters,numbers].

6.  Now join the two lists in the opposite order.

7.  Add an extra element, the letter w, to the letters list by issuing the command Append[letters,w].

8.  Did this change permanently affect letters?  Find out by asking Mathematica to give the value of letters again (letters followed by ENTER.)

9.  Apparently the answer to the last question was No!  The reason for this is that we never read our new result back into letters.  This time let's make the change stick by issuing the command letters=Append[letters,w].

10.  And now ask for the value of letters one more time.

11.  Show a little initiative by using the Prepend command to insert the element 0 (the number zero, not the letter oh) at the beginning of the list numbers without me telling you the exact command you need to give.  (Remember you can always use the ? command the check on the syntax of a new command.)  Make the change "stick" like we did in problem 9 for the letters list.

12.  Insert a new element, 52, in the third position of the letters list.  The command you need to use is Insert.  If you can't remember it being explained in class use ? to check the syntax of this command, or the Function Browser in the Help menu at the top of your screen.  Don't bother to make this change permanent.

13.  Use the Delete command to remove the 5 from the end of the numbers list.  (Be careful!  You now have a 0 at the beginning of this list so 5 is not actually the fifth element anymore.)  Make this a permanent change in the value of numbers.

14.  Ask Mathematica for the syntax of the command Table using the ? command.

15.  Use the Table command to	generate a list of the even number from 6 to 30, inclusive.

16.	Generate a list of the squares of 7 through 12, inclusive.

17. Generate a list of the powers of x from x^2 to x^9, inclusive.  (Note:  Your output should be algebraic in form.  If you inadvertantly assigned a numerical value to x earlier in this Mathematica session you must remove it by using the x=. command.)

18.  Ask Mathematica how long the list letters is.  The command you need is Length.  Again, look it up if you don't know how to use it.