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.

[f(a), f(b), f(c)]2.6 Expression Manipulation • 37> 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, Maple 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 ]> map(Diff, fcn_list, x);[ ddx sin(x), ddx ln(x), ddx (x2 )]> map(value, %);[cos(x), 1 x , 2 x]Not only can the procedure be an existing command, but you can alsocreate an operation to map onto a list. For example, suppose that you wantto square each element of a list. Replace each element (represented by x)with its square (x 2 ).> map(x->x^2, [-1,0,1,2,3]);

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

Saved successfully!

Ooh no, something went wrong!