Indexable.max - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : OpenMaple : Java Application Programming Interface : Indexable Class : OpenMaple/Java/Indexable/max

Indexable.max

return the maximum of the collection

Indexable.min

return the minimum of the collection

 

Calling Sequence

Description

Examples

Calling Sequence

int max( ) throws MapleException

int min( ) throws MapleException

Description

• 

The max function returns the maximum of the elements in the collection referenced by the Indexable object.

• 

The min function returns the minimum of the elements in the collection referenced by the Indexable object.

Examples

import com.maplesoft.openmaple.*;

import com.maplesoft.externalcall.MapleException;

class Example

{

    public static void main( String notused[] ) throws MapleException

    {

        String[] mapleArgs = { "java" };

        Engine engine = new Engine( mapleArgs, new EngineCallBacksDefault(), null, null );

        Indexable ind;

        ind = (Indexable)engine.evaluate( "{1,3,7,11}:" );

        System.out.println( "Min of set:" + ind.min() );

        System.out.println( "Max of set:" + ind.max() );

        ind = (Indexable)engine.evaluate( "table([a=1,b=2/3,c=Pi]):" );

        System.out.println( "Min of table:" + ind.min() );

        System.out.println( "Max of table:" + ind.max() );

    }

}

Executing this code produces the following output.

Min of set: 1

Max of set: 11

Min of table: 2/3

Max of table: Pi

See Also

ExternalCalling/Java/MapleException

OpenMaple

OpenMaple/Java/Algebraic

OpenMaple/Java/API

OpenMaple/Java/Indexable

OpenMaple/Java/Indexable/numElements