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.

28 • Chapter 2: Mathematics with Maple: the Basicsarray3 := array(1..2, 1..2, 1..2, [(1, 1, 1) = 1(1, 1, 2) = 2(1, 2, 1) = 3(1, 2, 2) = 4(2, 1, 1) = 5(2, 1, 2) = 6(2, 2, 1) = 7(2, 2, 2) = 8])Maple does not automatically expand the name of an array to therepresentation of all the elements. Thus, in some commands, you mustspecify explicitly that you want to perform an operation on the elements.Suppose that you want to replace each occurrence of the number 2 inpwrs with the number 9. To do substitutions such as this, you can usethe subs command. The basic syntax issubs( x=expr1, y=expr2, ... , main_expr )For example, to substitute x + y for z in an equation, do the following.> expr := z^2 + 3;expr := z 2 + 3> subs( {z=x+y}, expr);(x + y) 2 + 3You might, however, be disappointed when the following call to subsdoes not work.> subs( {2=9}, pwrs );pwrsYou must instead force Maple to fully evaluate the name of the arrayto the component level and not just to its name, using the commandevalm.

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

Saved successfully!

Ooh no, something went wrong!