EvalMapleProc - 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


MapleEval

evaluate a Maple object in external code

EvalMapleProc

evaluate a Maple function object in external code

EvalMapleStatement

parse and evaluate a command string in external code

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

MapleEval(kv, s)

EvalMapleProc(kv, fn, n, arg1, arg2, ..., argN)

EvalMapleStatement(kv, statement)

Parameters

kv

-

kernel handle of type MKernelVector

s

-

type ALGEB object

fn

-

Maple Procedure object of type ALGEB

n

-

number of args following

arg1, ..., argN

-

type ALGEB arguments to fn

statement

-

command string

Description

• 

These functions can be used in external code with OpenMaple or define_external.

• 

MapleEval evaluates the given Maple object, s. Evaluation is performed according to the rules used by the eval command.

• 

EvalMapleProc invokes the procedure, fn(arg1, arg2, ..., argN), where n specifies the number of arguments supplied to the function call.  The result of the evaluation is returned as a Maple object.  fn must be a Procedure object.

• 

EvalMapleStatement parses and executes the command string given in the statement argument. MapleAssign can be used to give external objects names that can be referenced in a command string.  The command string must be terminated by a colon or semicolon.  When using this command in OpenMaple, a colon suppresses the display of output.

Examples

    #include "maplec.h"

    ALGEB M_DECL MyStats( MKernelVector kv, ALGEB *args )

    {

    ALGEB mean, sd, f;

    if( 1 != MapleNumArgs(kv,(ALGEB)args) ) {

        MapleRaiseError(kv,"one argument expected");

        return( NULL );

    }

    if( !IsMapleList(kv,args[1]) ) {

        MapleRaiseError(kv,"list expected");

        return( NULL );

    }

    f = EvalMapleStatement(kv,"Statistics[Mean]:");

    mean = EvalMapleProc(kv,f,1,args[1]);

    f = EvalMapleStatement(kv,"Statistics[StandardDeviation]:");

    f = ToMapleFunction(kv,f,1,args[1]);

    sd = MapleEval(kv,f);

    return( ToMapleExpressionSequence(kv,2,mean,sd) );

    }

Execute the external function from Maple.

withExternalCalling:

dllExternalLibraryNameHelpExamples:

statDefineExternalMyStats,dll:

stat1,2,3,2,0,8

83,593

(1)

stat0.3,0.1,0.4,0.1,0.5,0.9,0.2,0.6,0.5,0.3,0.5

0.4000000000,0.2256304299

(2)

See Also

CustomWrapper

define_external

eval

OpenMaple

OpenMaple/C/API

OpenMaple/C/Examples