GAP (if) - Chapter 1: The GAP InterFace to other Computer Algebra Systems (CAS)

Goto Chapter: | Top | 1 | Ind

### 1. The GAP InterFace to other Computer Algebra Systems (CAS)

Warning: this file is under contruction! You can find the documentation in the ../README file.

#### 1.1 User's manual

##### 1.1-1 IF_Interface

`> IF_Interface`( conventional_CAS_name, CAS_function_name, List_of_Gap_objects ) | ( function )

See the ../README file for the list of interfaced CASes and the conventional_CAS_name's. CAS_function_name is the name of the function in the interfaced CAS, and is given as a string. List_of_Gap_objects is a list of Gap objects, O_1, O_2, ..., O_n, that will be used as arguments of CAS_function_name (it may be empty).

IF_Interface does the following:
a. converts each object O_1, O_2, ..., O_n in List_of_Gap_objects into the corresponding object P_1, P_2, ..., P_n, of the interfaced CAS;
b. sends the command CAS_function_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 ] ] ]

##### 1.1-2 InfoInterfaces

`> InfoInterfaces` | ( info class )

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

Top of Book | Previous Chapter | Next Chapter

Goto Chapter: | Top | 1 | Ind

generated by GAPDoc2HTML