'if'

Version 06.03.19
Marco Costantini costanti@science.unitn.it http://www-math.science.unitn.it/~costanti/
©right; 2004, 2005, 2006 Marco Costantini

The GAP InterFace to other Computer Algebra Systems (CAS) Warning: this file is under contruction! You can find the documentation in the ../README file.
User's manual See the ../README file for the list of interfaced CASes and the conventional&uscore;CAS&uscore;name's. CAS&uscore;function&uscore;name is the name of the function in the interfaced CAS, and is given as a string. List&uscore;of&uscore;Gap&uscore;objects is a list of Gap objects, O_1, O_2, ..., O_n, that will be used as arguments of CAS&uscore;function&uscore;name (it may be empty).

IF&uscore;Interface does the following:
a. converts each object O_1, O_2, ..., O_n in List&uscore;of&uscore;Gap&uscore;objects into the corresponding object P_1, P_2, ..., P_n, of the interfaced CAS;
b. sends the command CAS&uscore;function&uscore;name ( P_1, P_2, ..., P_n ) to the interfaced CAS;
c. gets the output from the interfaced CAS;
d. converts it to the corresponding Gap object, and returns it to the user.

With the code already implemented, the interface can perform, for instance, calculation like the following from within Gap, using the function primes, omega, and nextprime, of Pari/Gp.
IF_Interface( IF_pari_gp, "primes", [10] ); IF_Interface( IF_pari_gp, "omega", [360] ); IF_Interface( IF_pari_gp, "nextprime", [119] );

In the following example the greatest common divisor of 1000 and 360 is calculated using each CAS.
IF_Interface( IF_asir, "igcd", [1000, 360] ); IF_Interface( IF_cocoa, "GCD", [1000, 360] ); IF_Interface( IF_kash, "IntGcd", [1000,360] ); IF_Interface( IF_singular, "gcd", [1000, 360] ); IF_Interface( IF_plural, "gcd", [1000, 360] ); IF_Interface( IF_pari_gp, "gcd", [1000, 360] ); IF_Interface( IF_gap, "GcdInt", [1000, 360] ); IF_Interface( IF_aribas, "gcd", [1000, 360] ); IF_Interface( IF_mupad, "gcd", [1000, 360] ); IF_Interface( IF_maple, "gcd", [1000, 360] ); IF_Interface( IF_macaulay, "gcd", [1000, 360] ); IF_Interface( IF_mathematica, "GCD", [1000, 360] ); IF_Interface( IF_yacas, "Gcd", [1000, 360] );
This second example shows that it is possible to interface many CASes in the same Gap session.

gap> IF_Interface(IF_mupad, "combinat::partitions::list", [4]); [ [ 4 ], [ 3, 1 ], [ 2, 2 ], [ 2, 1, 1 ], [ 1, 1, 1, 1 ] ] gap> IF_Interface(IF_mupad, "combinat::tableaux::list", [[4,2]]); [ [ [ 5, 6 ], [ 1, 2, 3, 4 ] ], [ [ 4, 6 ], [ 1, 2, 3, 5 ] ], [ [ 3, 6 ], [ 1, 2, 4, 5 ] ], [ [ 2, 6 ], [ 1, 3, 4, 5 ] ], [ [ 4, 5 ], [ 1, 2, 3, 6 ] ], [ [ 3, 5 ], [ 1, 2, 4, 6 ] ], [ [ 2, 5 ], [ 1, 3, 4, 6 ] ], [ [ 3, 4 ], [ 1, 2, 5, 6 ] ], [ [ 2, 4 ], [ 1, 3, 5, 6 ] ] ]
The following command
gap> SetInfoLevel( InfoInterfaces, 3 );
tells to Gap to print the input and the output of the interfaced CAS; it may be useful for debugging purposes. This debugging information is suppressed by
gap> SetInfoLevel( InfoInterfaces, 0 );