MapleSelectIndexed - select from a table, list, or rtable in external code
MapleSelectImaginaryPart - select the imaginary part of a complex-valued expression in external code
MapleSelectRealPart - select the real part of a complex-valued expression in external code
|
Calling Sequence
|
|
MapleSelectIndexed(kv, s, n, ind)
MapleSelectImaginaryPart(kv, s)
MapleSelectRealPart(kv, s)
|
|
Parameters
|
|
kv
|
-
|
kernel handle of type MKernelVector
|
s
|
-
|
type ALGEB indexable object
|
n
|
-
|
length of ind
|
ind
|
-
|
index array
|
|
|
|
|
Description
|
|
•
|
MapleSelectIndexed retrieves the element s[ind], where s is a list, set, table, or rtable object. The index is an integer array. To reference s[1,2], set ind[0] = 1, and ind[1] = 2;.
|
•
|
MapleSelectImaginaryPart returns the imaginary part of s. MapleSelectRealPart returns the real part of s. These commands are equivalent to the Maple Im and Re commands.
|
|
|
Examples
|
|
#include "maplec.h"
|
ALGEB M_DECL MyRe( MKernelVector kv, ALGEB *args )
|
{
|
ALGEB list, val;
|
char *code;
|
M_INT i, n, index[1];
|
if( MapleNumArgs(kv,(ALGEB)args) != 2 ) {
|
MapleRaiseError(kv,"two arguments expected");
|
return( NULL );
|
}
|
n = MapleToM_INT(kv,args[1]);
|
list = MapleListAlloc(kv,n);
|
for( i=1; i<=n; ++i ) {
|
index[0] = i;
|
val = MapleSelectIndexed(kv,args[2],1,index);
|
MapleListAssign(kv,list,i,MapleSelectRealPart(kv,val));
|
}
|
return( list );
|
}
|
|
|
Execute the external function from Maple.
>
|
|
>
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
|
|