12.07.2015 Views

Learning Guide Learning Guide

Learning Guide Learning Guide

Learning Guide Learning Guide

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

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

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

172 • Chapter 5: Evaluation and Simplification50 + y 2 + sin(x) 2The map, map2, seq, add, and mul commands can also act on generalexpressions. See this section, pages 169–171.Choosing Elements from a List or SetYou can select certain elements from a list or a set, if you have a booleanvaluedfunction that determines which elements to select. The followingboolean-valued function returns true if its argument is larger than three.> large := x -> is(x > 3);large := x → is(3 < x)You can now use the select command to choose the elements in alist or set that satisfy large.> L := [ 8, 2.95, Pi, sin(9) ];L := [8, 2.95, π, sin(9)]> select( large, L );[8, π]Similarly, the remove command removes the elements from L thatsatisfy large and displays as output the remaining elements.> remove( large, L );[2.95, sin(9)]To perform both operations simultaneously, use the selectremovecommand.> selectremove( large, L);[8, π], [2.95, sin(9)]Use the type command to determine the type of an expression.

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

Saved successfully!

Ooh no, something went wrong!