Download Maple T.A. User Guide
Transcript
10.18 Functions and Arguments • 225
gcd(a, b)
gcd(a, b)
Returns the greatest common divisor of a and b.
For example,
gcd(12, 15)
returns 3
gt(a, b), lt(a, b)
gt(a, b)
Returns 1.0 if a is greater than b, that is (a > b). Otherwise, it returns 0.0.
lt(a, b)
Returns 1.0 if a is less than b, that is (a < b). Otherwise, it returns 0.0.
if(a, b, c)
if(a, b, c)
If a is nonzero, it returns b. Otherwise, it returns c.
indexof(k, a, b, c, d, ...)
Returns the index of an item within a list (the first item is in position 0, the second in position 1, and so on).
For example,
indexof(3, 2, 3, 5, 7, 11)
returns 1
java(cn, a, b, c, d, ...)
java(cn, a, b, c, d, ...)
Pass the arguments a,b,c,d,.. to a custom JavaTM evaluation engine and return the result. The first argument (cn) must
be a string giving the fully qualified name of a Java class that implements the interface
gateway.question.random.AlgorithmicFunction.
This interface has a single public method.
public String eval(String[ ] args);
The arguments a,b,c,d,... are passed to eval() in a string array.
For example,
java("com.mycompany.QuoteFunction", "SUNW")
returns a real-time quote for Sun Microsystems, Inc. stock (assuming that the class QuoteFunction had been suitably
programmed).