select - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


List.select

return an element stored within a list

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Algebraic select( int i ) throws MapleException

Parameters

i

-

index of the entry to return

Description

• 

The select function returns the Algebraic object stored in index i of the List.

• 

Valid values of i are 1..n where n is the length of the list.  The length can be obtained by calling numElements.

• 

This is identical to get except that its index is one-based and it throws a MapleException.

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 );

        List l;

        int i;

        l = (List)engine.evaluate( "[seq( (2^(i)), i=1..10 )]:" );

        for ( i = 1; i <= 10; i++ )

        {

            System.out.println( l.select(i) );

        }

        try

        {

            l.select(11);

        }

        catch ( MapleException me )

        {

            System.out.println( me.getMessage() );

        }

        try

        {

            l.select(0);

        }

        catch ( MapleException me )

        {

            System.out.println( me.getMessage() );

        }

    }

}

Executing this code produces the following output.

2

4

8

16

32

64

128

256

512

1024

Error, bad index, 11, into list

Error, bad index, 0, into list

See Also

ExternalCalling/Java/MapleException

OpenMaple

OpenMaple/Java/Algebraic

OpenMaple/Java/API

OpenMaple/Java/Indexable

OpenMaple/Java/List

OpenMaple/Java/List/assign

OpenMaple/Java/List/contains

OpenMaple/Java/List/containsAll

 


Download Help Document