11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming 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.

2.5 Extending Maple • 31> ‘type/LINEAR‘ := proc(f, V::name)> type( f, polynom(anything, V) ) and degree(f, V) = 1;> end proc:> type( a*x+b, LINEAR(x) );true> type( x^2, LINEAR(x) );false> type( a, LINEAR(x) );falseExercises1. Modify the ‘type/LINEAR‘ procedure so that you can use it to testif an expression is linear in a set of variables. For example, x + ay + 1is linear in both x and y, but xy + a + 1 is not.2. Define the type POLYNOM(X) which tests if an algebraic expression isa polynomial in X where X is a name, a list of names, or a set ofnames.Neutral OperatorsThe Maple software recognizes many operators, for example +, *, ^, and,not, and union. These operators have special meaning to Maple. Theoperators can represent:• Algebraic operations, such as addition or multiplication• Logical operations• Operations performed on setsMaple also has a special class of operators, the neutral operators,on which it does not impose any meaning. Instead, Maple allows youto define the meaning of any neutral operator. The name of a neutraloperator begins with the ampersand character (&).> 7 &^ 8 &^ 9;

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

Saved successfully!

Ooh no, something went wrong!