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


<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE Book SYSTEM "http://www-math.science.unitn.it/~costanti/DTD/gapdoc.dtd">

<Book Name="if">

<TitlePage>
  <Title> <Package>'if'</Package> </Title>
  <Version>Version 06.03.19</Version>
  <Author> Marco Costantini
   <Email> costanti@science.unitn.it </Email>
<Homepage>http://www-math.science.unitn.it/~costanti/</Homepage>
  </Author>

  <Copyright>&copyright; 2004, 2005, 2006 Marco Costantini <P/>
  </Copyright>
</TitlePage>

<TableOfContents/>

<Body>

<Chapter> <Heading>The GAP InterFace to other Computer Algebra Systems (CAS)</Heading>

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

<Section><Heading>User's manual</Heading>



<ManSection>
<Func Name="IF_Interface" Arg ="conventional_CAS_name, CAS_function_name, List_of_Gap_objects"/>

<Description>
See the ../README file for the list of interfaced CASes and the
<A>conventional&uscore;CAS&uscore;name</A>'s.
<A>CAS&uscore;function&uscore;name</A> is the name of the function in the interfaced CAS, and
is given as a string.
<A>List&uscore;of&uscore;Gap&uscore;objects</A> is a list of Gap objects, <M>O_1, O_2, ..., O_n</M>, 
that will be used as arguments of <A>CAS&uscore;function&uscore;name</A> (it may be empty).

<P/>

<A>IF&uscore;Interface</A> does the following:<Br/>

a. converts each object <M>O_1, O_2, ..., O_n</M> in <A>List&uscore;of&uscore;Gap&uscore;objects</A> 
   into the corresponding object <M>P_1, P_2, ..., P_n</M>, of the interfaced CAS;<Br/>
b. sends the command <M>CAS&uscore;function&uscore;name ( P_1, P_2, ..., P_n )</M> to the
   interfaced CAS;<Br/>
c. gets the output from the interfaced CAS;<Br/>
d. converts it to the corresponding Gap object, and returns it to the user.<Br/>

<P/>

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.
<Example>
IF_Interface( IF_pari_gp, "primes", [10] );
IF_Interface( IF_pari_gp, "omega", [360] );
IF_Interface( IF_pari_gp, "nextprime", [119] );
</Example>

<P/>

In the following example the greatest common divisor of 1000 and 360 is
calculated using each CAS.

<Example>
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] );
</Example>

This second example shows that it is possible to interface many CASes in
the same Gap session.

<P/>

<Example>
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 ] ] ]

</Example>


</Description>
</ManSection>


<ManSection>
<InfoClass Name="InfoInterfaces"/>
<Description>

The following command

<Example>
gap> SetInfoLevel( InfoInterfaces, 3 );
</Example>

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

<Example>
gap> SetInfoLevel( InfoInterfaces, 0 );
</Example>

</Description>
</ManSection>


</Section>

</Chapter>

</Body>

<TheIndex/>

</Book>

