<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>GAP (if) - Chapter 1: The GAP InterFace to other Computer Algebra Systems (CAS)</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <meta name="generator" content="GAPDoc2HTML" /> <link rel="stylesheet" type="text/css" href="manual.css" /> </head> <body> <div class="pcenter"><table class="chlink"><tr><td class="chlink1">Goto Chapter: </td><td><a href="chap0.html">Top</a></td><td><a href="chap1.html">1</a></td><td><a href="chapInd.html">Ind</a></td></tr></table><br /></div> <p><a id="s0ss0" name="s0ss0"></a></p> <h3>1. The GAP InterFace to other Computer Algebra Systems (CAS)</h3> <p>Warning: this file is under contruction! You can find the documentation in the ../README file.</p> <p><a id="s1ss0" name="s1ss0"></a></p> <h4>1.1 User's manual</h4> <p><a id="s1ss1" name="s1ss1"></a></p> <h5>1.1-1 IF_Interface</h5> <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">> IF_Interface</code>( <var>conventional_CAS_name, CAS_function_name, List_of_Gap_objects</var> )</td><td class="tdright">( function )</td></tr></table></div> <p>See the ../README file for the list of interfaced CASes and the <var>conventional_CAS_name</var>'s. <var>CAS_function_name</var> is the name of the function in the interfaced CAS, and is given as a string. <var>List_of_Gap_objects</var> is a list of Gap objects, O_1, O_2, ..., O_n, that will be used as arguments of <var>CAS_function_name</var> (it may be empty).</p> <p><var>IF_Interface</var> does the following:<br /> a. converts each object O_1, O_2, ..., O_n in <var>List_of_Gap_objects</var> into the corresponding object P_1, P_2, ..., P_n, of the interfaced CAS;<br /> b. sends the command CAS_function_name ( P_1, P_2, ..., P_n ) 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> <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.</p> <table class="example"> <tr><td><pre> IF_Interface( IF_pari_gp, "primes", [10] ); IF_Interface( IF_pari_gp, "omega", [360] ); IF_Interface( IF_pari_gp, "nextprime", [119] ); </pre></td></tr></table> <p>In the following example the greatest common divisor of 1000 and 360 is calculated using each CAS.</p> <table class="example"> <tr><td><pre> 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] ); </pre></td></tr></table> <p>This second example shows that it is possible to interface many CASes in the same Gap session.</p> <table class="example"> <tr><td><pre> 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 ] ] ] </pre></td></tr></table> <p><a id="s1ss2" name="s1ss2"></a></p> <h5>1.1-2 InfoInterfaces</h5> <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">> InfoInterfaces</code></td><td class="tdright">( info class )</td></tr></table></div> <p>The following command</p> <table class="example"> <tr><td><pre> gap> SetInfoLevel( InfoInterfaces, 3 ); </pre></td></tr></table> <p>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</p> <table class="example"> <tr><td><pre> gap> SetInfoLevel( InfoInterfaces, 0 ); </pre></td></tr></table> <div class="pcenter"> <table class="chlink"><tr><td><a href="chap0.html">Top of Book</a></td><td><a href="chap0.html">Previous Chapter</a></td><td><a href="chapInd.html">Next Chapter</a></td></tr></table> <br /> <div class="pcenter"><table class="chlink"><tr><td class="chlink1">Goto Chapter: </td><td><a href="chap0.html">Top</a></td><td><a href="chap1.html">1</a></td><td><a href="chapInd.html">Ind</a></td></tr></table><br /></div> </div> <hr /> <p class="foot">generated by <a href="http://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p> </body> </html>