To practice the commands outlined in class, try the following problems.
Arrays, print command, and for-loop
1. a. Use the `array' command to generate a table with one row of length five by typing
A := array( 1..5 ):
for i from 1 to 3 do v[ i ] := 2*i od:
print( v ); (Press ENTER now.)
b. Find v[ 3 ].
c. Find v[ 6 ]. (Note, you will get an error message.)
d. Assign the values 1/3, 2/3, 1, 4/3 to an array. Use `print' and `evalf' to create two tables with the given values.
e. Use the `array' command to make a two-dimensional table.
B := array( 1..2, 1..3 ):
print(B); (Press ENTER now.)
Sequences
2. a. Generate the sequence of values for x^3 from x = 1 to x = 40 by typing
seq( x^3, x = 1..40 );
b. Assign a sequence to a variable in the following way.
L := [ seq( i, i = 0..6 ) ];
c. Generate a sequence of values for the equation, f(x) = 3x + 4, for x = 0 to x = 10.
Procedures
3. a. Use the `procedure' command to find values of the function, f(x) = sin( x )/x by typing
f := proc(x);
sin(x)/x;
end; (Press ENTER now.)
b. Find f( 1 ).
c. Find f( Pi ).
Link to Maple Array Page
Link to Maple Handouts Page
Link to Maple Home Page
Back to Ellerbruch Web Site Home
Link to Math Department Home
Link to Northern Michigan University
Jo Norby-Davis: jnorbyda@nmu.edu.