11.07.2015 Views

Maple 9 Learning Guide - Maplesoft

Maple 9 Learning Guide - Maplesoft

Maple 9 Learning Guide - Maplesoft

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

38 • Chapter 2: Mathematics with <strong>Maple</strong>: The Basics> combine((x^a)^2, power);(2 a)xThe map CommandThis command is useful when working with lists, sets, or arrays. It providesa means for working with multiple solutions or for applying anoperation to each element of an array.The map command applies a command to each element of a datastructure or expression. While it is possible to write program structuressuch as loops to accomplish these tasks, you should not underestimate theconvenience and power of the map command. The map command is one ofthe most useful commands in <strong>Maple</strong>.> map( f, [a,b,c] );[f(a), f(b), f(c)]> data_list := [0, Pi/2, 3*Pi/2, 2*Pi];data_list := [0, 1 2 π, 3 π, 2 π]2> map(sin, data_list);[0, 1, −1, 0]If you give the map command more than two arguments, <strong>Maple</strong> passesthe last argument(s) to the initial command.> map( f, [a,b,c], x, y );[f(a, x, y), f(b, x, y), f(c, x, y)]For example, to differentiate each item in a list with respect to x, youcan use the following commands.> fcn_list := [sin(x),ln(x),x^2];fcn_list := [sin(x), ln(x), x 2 ]

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

Saved successfully!

Ooh no, something went wrong!