11.07.2015 Views

Maple 9 Learning Guide - Maplesoft

Maple 9 Learning Guide - Maplesoft

Maple 9 Learning Guide - Maplesoft

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6.3 Structural Manipulations • 181> map( f, [a, b, c], p, q );[f(a, p, q), f(b, p, q), f(c, p, q)]> map( diff, [ (x+1)*(x+2), x*(x+2) ], x );[2 x + 3, 2 x + 2]Using the map2 Command The map2 command is closely related to map.Whereas map sequentially replaces the first argument of a function, themap2 command replaces the second argument to a function.> map2( f, p, [a,b,c], q, r );[f(p, a, q, r), f(p, b, q, r), f(p, c, q, r)]You can use map2 to list all the partial derivatives of an expression.> map2( diff, x^y/z, [x,y,z] );[ xy yx z , xy ln(x), − xyz z 2 ]You can use map2 in conjunction with the map command. For an example,see the ?map help page.Using the seq Command You can use the seq command to generatesequences resembling the output from map. In this example, seq generatesa sequence by applying the function f to the elements of a set and a list.> seq( f(i), i={a,b,c} );f(a), f(b), f(c)> seq( f(p, i, q, r), i=[a,b,c] );f(p, a, q, r), f(p, b, q, r), f(p, c, q, r)Another example is Pascal’s Triangle.> L := [ seq( i, i=0..5 ) ];

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

Saved successfully!

Ooh no, something went wrong!