Question: OpenMaple Problem


I am writing a program in C that uses the open maple library. It is not the first time that I use it but now I am facing a strange problem that involves the simplify command: suppose a,x,y are symbols that are not previously used in maple, the following lines

1)  EvalMapleStatement(kv, "simplify((a*x^2-y^2)/(x^2*y^2-1));");

2)  EvalMapleStatement(kv, "simplify((2*x^2-y^2)/(x^2*y^2-1));");

only differ by the fact that the parameter a is replaced by 2 in the second line. But they return the following output:

1) (a*x^2-y^2)/(x^2*y^2-1)

that is correct, nothing to simplify..

2) Error, (in gcd/LinZip) input must be polynomials over the integers

I must be doing something wrong but I am getting nowhere...



P.S. This is the complete listing 


#include <stdio.h>

#include <stdlib.h>


#include "maplec.h"


static void M_DECL textCallBack( void *data, int tag, char *output )





int main( int argc, char *argv[] )


    char err[2048];  /* command input and error string buffers */

    MKernelVector kv;  /* Maple kernel handle */

    MCallBackVectorDesc cb = {  textCallBack,

                                0,   /* errorCallBack not used */

                                0,   /* statusCallBack not used */

                                0,   /* readLineCallBack not used */

                                0,   /* redirectCallBack not used */

                                0,   /* streamCallBack not used */

                                0,   /* queryInterrupt not used */

                                0    /* callBackCallBack not used */


    ALGEB r, l;  /* Maple data-structures */

        char *myargv[]={"maple"};

        int myargc=1;


    if( (kv=StartMaple(myargc,myargv,&cb,NULL,NULL,err)) == NULL ) {

        printf("Fatal error, %s\n",err);

        return( 1 );



EvalMapleStatement(kv, "simplify((a*x^2-y^2)/(x^2*y^2-1));");


EvalMapleStatement(kv, "simplify((2*x^2-y^2)/(x^2*y^2-1));");




    return( 0 );



compiled with

gcc prova.c -I /Library/Frameworks/Maple.framework/Versions/Current/extern/include/ -L /Library/Frameworks/Maple.framework/Versions/Current/bin.APPLE_UNIVERSAL_OSX/ -l maplec

Please Wait...