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.

5.3 Structural Manipulations • 177> list1 := sort(list1);list1 := [“a”, “b”, “c”, “d”]> list2 := sort(list2);list2 := [1, 2, 3, 5, 9]Finally, stack the two lists together.> sorted_list := [ op(list1), op(list2) ];sorted _list := [“a”, “b”, “c”, “d”, 1, 2, 3, 5, 9]The sort command can also sort algebraic expressions. See section5.1.This section, pages 172–173, gives more information about the commandsin this example.The Parts of an ExpressionTo manipulate the details of an expression, you must select the individualparts. Three easy cases for doing this involve equations, ranges, andfractions. The lhs command selects the left-hand side of an equation.> eq := a^2 + b^ 2 = c^2;eq := a 2 + b 2 = c 2> lhs( eq );a 2 + b 2The rhs command similarly selects the right-hand side.> rhs( eq );c 2The lhs and rhs commands also work on ranges.> lhs( 2..5 );

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

Saved successfully!

Ooh no, something went wrong!