gap> 
gap> 
gap> # Start
gap> 
gap> START_TEST( "Test of the 'if' package" );
gap> SizeScreen([80]);;
gap> 
gap> 
gap> IF_Interface(IF_maple, "gcd", [1000, 360] );
40
gap> 
gap> 
gap> # `..`
gap> 
gap> IF_Type(IF_maple, [-5..3]);
"`..`"
gap> IF_ConvertFromGap(IF_maple, [-5..3]);
"-5 .. 3"
gap> IF_Interface(IF_maple, "", [[-5..3]]);
[ -5 .. 3 ]
gap> 
gap> 
gap> # integer
gap> 
gap> l := [-3^30, -1, 0, 1, 3^70];;
gap> List(l, x->IF_Type(IF_maple, x));
[ "integer", "integer", "integer", "integer", "integer" ]
gap> l=List(l, x-> IF_Interface(IF_maple, "", [x]));
true
gap> 
gap> 
gap> # string
gap> 
gap> l := Difference([0..255], IF_PROHIBITED_CHARS[IF_maple]);;
gap> l1:= List( l{[1..110]}, CHAR_INT);;
gap> l2:= List( l{[110..Length(l)]}, CHAR_INT);;
gap> for i in [l1,l2] do
>     ConvertToStringRep( i );
>     if not i=IF_Interface(IF_maple, "", [i]) then
>         Print( "different strings!\n" );
>     fi;
> od;
gap> 
gap> 
gap> # list
gap> 
gap> l:=[ [ 2 .. 5 ], 53, "ciao", [ 1, 2, 4 ], 33/4 ];;
gap> l=IF_Interface(IF_maple, "", [l] );
true
gap> []=IF_Interface(IF_maple, "", [[]]); # empty list
true
gap> 
gap> 
gap> # boolean
gap> 
gap> IF_Interface(IF_maple, "not", [true] );
false
gap> IF_Interface(IF_maple, "not", [false] );
true
gap> IF_Interface(IF_maple, "FAIL or", [false] );
fail
gap> 
gap> 
gap> # rational
gap> 
gap> c:=Enumerator(Rationals);
<enumerator of Rationals>
gap> for i in [1..20] do
>   if not c[i]=IF_Interface(IF_maple, "", [c[i]] ) then
>     Print( c[i], " ", fail, "\n");
>   fi;
> od;
gap> 
gap> 
gap> # complex
gap> 
gap> Print( "imaginary unit ", IF_Interface(IF_maple, "", [E(4)] ), "\n" );
imaginary unit E(4)
gap> c:=Enumerator(GaussianRationals);
<enumerator of GaussianRationals>
gap> for i in [1..50] do
>   if not c[i]=IF_Interface(IF_maple, "", [c[i]] ) then
>     Print( i, " ", c[i], " ", fail, "\n");
>   fi;
> od;
gap> root_10_2 := IF_Interface(IF_maple, "root", [10,2]);
-E(40)^7+E(40)^13-E(40)^21-E(40)^23-E(40)^29+E(40)^31+E(40)^37+E(40)^39
gap> root_10_2^2=10;
true
gap> 
gap> 
gap> # extended_numeric
gap> 
gap> infinity = IF_Interface(IF_maple, "", [infinity]);
true
gap> 
gap> 
gap> # polynom
gap> 
gap> R:=PolynomialRing(Rationals, [ "x_1", "x_2", "x_3", "x_4" ] : new);
PolynomialRing(..., [ _X, x_2, x_3, x_4 ])
gap> g:=GeneratorsOfLeftOperatorRingWithOne(R);
[ _X, x_2, x_3, x_4 ]
gap> p1:=g[1]*g[3]^3-12*g[2]*g[4]*g[1]^4;
-12*_X^4*x_2*x_4+_X*x_3^3
gap> IF_ConvertFromGap(IF_maple, p1);
"((1)*x_1^1*x_3^3+(-12)*x_1^4*x_2^1*x_4^1)"
gap> p2:=IF_Interface(IF_maple, "", [p1] );
-12*_X^4*x_2*x_4+_X*x_3^3
gap> p2=p1;
true
gap> 
gap> x:=Indeterminate(Rationals,"x":new);
x
gap> y:=Indeterminate(Rationals,"y":new);
y
gap> IF_Interface(IF_maple, "PolynomialTools[MinimalPolynomial]", [4+E(4),6]);
_X^2-8*_X+17
gap> IF_Interface(IF_maple, "solve", [x^2+4*x+1]);
#I  Options stack is already empty
[ 2*E(12)^4-E(12)^7+2*E(12)^8+E(12)^11, 2*E(12)^4+E(12)^7+2*E(12)^8-E(12)^11 ]
gap> IF_Interface(IF_maple, "solve", [x^2+4*x+y,x-y]);
#I  Warning in Maple: Warning, solving for expressions other than names or fun\
ctions is not recommended.
#I  Options stack is already empty
[  ]
gap> 
gap> 
gap> # ratpoly
gap> 
gap> q:= g[2]^3*g[3]^2+4*g[1]+g[4]^6-8;
x_4^6+x^3*y^2+4*_X-8
gap> r1 :=p1/q;
(-12*_X^4*x*x_4+_X*y^3)/(x_4^6+x^3*y^2+4*_X-8)
gap> r2:=IF_Interface(IF_maple, "", [r1] );
(-12*_X^4*x*x_4+_X*y^3)/(x_4^6+x^3*y^2+4*_X-8)
gap> r1=r2;
true
gap> 
gap> 
gap> # SDMPolynom
gap> 
gap> IF_Interface(IF_maple, "", "x_1^3+5*x_1^2+11*x_1+15")= 
> IF_Interface(IF_maple, "", "SDMPolynom(x_1^3+5*x_1^2+11*x_1+15,x_1)");
true
gap> 
gap> 
gap> # float
gap> 
gap> IF_Interface(IF_maple, "fsolve", [x^2+4*x+1]);
#I  Options stack is already empty
[ "-3.732050808", "-.2679491924" ]
gap> 
gap> 
gap> # Matrix
gap> 
gap> m:=[[11,12,13],[21,22,23]];
[ [ 11, 12, 13 ], [ 21, 22, 23 ] ]
gap> IF_ConvertFromGap( IF_maple,m);
"Matrix( 2, 3, [\n[11,12,13],\n[21,22,23]] )"
gap> m=IF_Interface( IF_maple,"",[m]);
true
gap> 
gap> m:=[[11/5]];
[ [ 11/5 ] ]
gap> IF_ConvertFromGap( IF_maple,m);
"Matrix( 1, 1, [\n[11/5]] )"
gap> m=IF_Interface( IF_maple,"",[m]);
true
gap> 
gap> m:=[[11/5,12/5,13/5],[21/5,22/5,23/5]];
[ [ 11/5, 12/5, 13/5 ], [ 21/5, 22/5, 23/5 ] ]
gap> IF_ConvertFromGap( IF_maple,m);
"Matrix( 2, 3, [\n[11/5,12/5,13/5],\n[21/5,22/5,23/5]] )"
gap> m=IF_Interface( IF_maple,"",[m]);
true
gap> 
gap> m:=[[ 4*g[1]*g[3]^2, -g[2]-g[4]],
>  [ E(4)*g[1]+g[1]^2*g[2]^3, (-1-E(4))*g[3]-2*(1+E(4))*g[4]]];
[ [ 4*_X*y^2, -x-x_4 ], [ _X^2*x^3+E(4)*_X, (-1-E(4))*y+(-2-2*E(4))*x_4 ] ]
gap> m=IF_Interface( IF_maple,"",[m]);
true
gap> 
gap> 
gap> # Vector[row]
gap> 
gap> m:=[11,12,13,21,22,23];
[ 11, 12, 13, 21, 22, 23 ]
gap> IF_ConvertFromGap( IF_maple,m);
"Vector[row]( 6, [11,12,13,21,22,23] )"
gap> m=IF_Interface( IF_maple,"",[m]);
true
gap> 
gap> m:= [p1,q,r1];
[ -12*_X^4*x*x_4+_X*y^3, x_4^6+x^3*y^2+4*_X-8, 
  (-12*_X^4*x*x_4+_X*y^3)/(x_4^6+x^3*y^2+4*_X-8) ]
gap> m=IF_Interface( IF_maple,"",[m]);
true
gap> 
gap> 
gap> 
gap> # end of test file
gap> 
gap> STOP_TEST( "test", 10000 );
Test of the 'if' package
GAP4stones: 1
gap> 
