12.07.2015 Views

Learning Guide Learning Guide

Learning Guide Learning Guide

Learning Guide Learning Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

26 • Chapter 2: Mathematics with Maple: the Basicscubes := [1, 8, 27]You can select a single element using the same notation applied tolists.> squares[2];4You must declare arrays in advance. To see the array’s contents, youmust use a command such as print.> squares;squares> print(squares);[1, 4, 9]The preceding array has only one dimension, but arrays can have morethan one dimension. Define a 3 × 3 array.> pwrs := array(1..3,1..3);pwrs := array(1..3, 1..3, [])This array has dimension two (two sets of indices). To begin, assignthe array elements of the first row.> pwrs[1,1] := 1; pwrs[1,2] := 1; pwrs[1,3] := 1;pwrs 1, 1 := 1pwrs 1, 2 := 1pwrs 1, 3 := 1Now continue for the rest of the array. If you prefer, you can end eachcommand with a colon (:), instead of the usual semicolon (;), to suppressthe output. Both the colon and semicolon are statement separators.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!