Checks for maps  

> # Check that different programs give the same answers!
{seq(seq(Hng(n,g/2)-subs(u=1,z=1,HHng(n,g/2)),g=0..5),n=1..10)},
{seq(seq(HngW(n,g/2)-HHng(n,g/2),g=0..5),n=1..10)};
 

{0}, {0} (4.1.1)
 

> # PLANAR MAPS
seq(subs(u=1,z=1,mapsEdgesGenus(i,0)),i=1..10);
# coincide with Tutte's formula!
seq(2*3^i/(i+2)/(i+1)*binomial(2*i,i),i=1..10);


 

 

2, 9, 54, 378, 2916, 24057, 208494, 1876446, 17399772, 165297834
2, 9, 54, 378, 2916, 24057, 208494, 1876446, 17399772, 165297834 (4.1.2)
 

> # MAPS PROJECTIVE PLANE
# Closed formula taken from OEIS)
RR:=sqrt(1-12*x):
seq(coeff(series(((2*RR+1)/3-sqrt(RR*(RR+2)/3))/(2*x), x, 12), x, n), n=1..10);
seq(Hng(i,1/2),i=1..10);
 

 

1, 10, 98, 982, 10062, 105024, 1112757, 11934910, 129307100, 1412855500
1, 10, 98, 982, 10062, 105024, 1112757, 11934910, 129307100, 1412855500 (4.1.3)
 

> # OEIS imports:
torusOEIS:=[0,1, 20, 307, 4280, 56914, 736568, 9370183, 117822512, 1469283166, 18210135416, 224636864830, 2760899996816, 33833099832484, 413610917006000, 5046403030066927, 61468359153954656, 747672504476150374, 9083423595292949240, 110239596847544663002, 1336700736225591436496, 16195256987701502444284]:
kleinOEIS:=[0,4, 84, 1340, 19280, 263284, 3486224, 45247084, 579150012, 7338291224, 92272957568, 1153361204996, 14348020042512, 177803262186064, 2196338193610064, 27057921450352204, 332583930387073712]:
genusThreeHalfOEIS:=[0,0,41, 1380, 31225, 592824, 10185056, 164037704, 2525186319, 37596421940, 545585129474, 7758174844664, 108518545261360, 1497384373878512, 20426386710028260, 275940187259609296, 3696482210884173349]:
 

> # TEST genus 1
seq(torusOEIS[i]+kleinOEIS[i],i=1..10);
seq(Hng(i,1),i=1..10);
 

 

0, 5, 104, 1647, 23560, 320198, 4222792, 54617267, 696972524, 8807574390
0, 5, 104, 1647, 23560, 320198, 4222792, 54617267, 696972524, 8807574390 (4.1.4)
 

> # TEST genus 3/2
seq(genusThreeHalfOEIS[i],i=1..10);
seq(Hng(i,3/2),i=1..10);
 

 

0, 0, 41, 1380, 31225, 592824, 10185056, 164037704, 2525186319, 37596421940
0, 0, 41, 1380, 31225, 592824, 10185056, 164037704, 2525186319, 37596421940 (4.1.5)
 

> # speed tests: HngW is indeed much faster
time(): seq(mapsEdgesGenus(k,0),k=1..15):
time()-%%;
time(): seq(mapsEdgesGenusBounded(k,0),k=1..15):
time()-%%;
time(): seq(HngW(k,0),k=1..15):
time()-%%;
 

 

 

4.277
2.450
0.3e-2 (4.1.6)
 

> # Checks for one-face maps against Ledoux's formula!
# one-face maps, k vertices and p edges
Led:=proc(k,p);
if (k<=0) or (k>p+1) then  0;
elif (k=p+1)         then  1/(p+1)*binomial(2*p,p);
elif (k=1) and (p=1) then  1;
elif (k=1) and (p=2) then  5;
elif (k=2) and (p=2) then  5;
elif (k=1) and (p=3) then  41;
elif (k=2) and (p=3) then  52;
elif (k=3) and (p=3) then  22;
else
  ( (8*p-2)*Led(k-1,p-1) - (4*p-1)*Led(k,p-1)
               +p*(2*p-3)*(10*p-9)*Led(k,p-2) - 8 *(2*p-3)*Led(k-2,p-2)
               +8*(2*p-3)*Led(k-1,p-2) - 10*(2*p-3)*(2*p-4)*(2*p-5)*Led(k-1,p-3)
               +5*(2*p-3)*(2*p-4)*(2*p-5)*Led(k,p-3)
               -2*(2*p-3)*(2*p-4)*(2*p-5)*(2*p-6)*(2*p-7)*Led(k,p-4)
   )/(p+1):
fi;
end:


Led(1,3);
coeff(HngW(3,3/2),z,1);


{seq(seq(subs(u=1,coeff(HngW(n,g/2),z,1))-Led(n+1-g,n),g=0..5),n=1..10)};
 

 

 

41
`+`(`*`(41, `*`(u)))
{0} (4.1.7)
 

> #Check: total number of maps of size n, regardless of genus or other parameters
# we make an exponential generating function
add(mapsEdges(n)*t^n/4/n,n=1..15):
series(exp(subs(u=1,z=1,%)),t=0,15);

# This can be encoded by gluing matchings and we have an explicit formula:
1+add((4*n)!/4^n/(2*n)!*(2*n)! /2^(2*n)/n! *t^(n)/(2*n)!,n=1..15):
series(%-%%,t=0,48);
 

 

series(`+`(1, `*`(`/`(3, 4), `*`(t)), `*`(`/`(105, 32), `*`(`^`(t, 2))), `*`(`/`(3465, 128), `*`(`^`(t, 3))), `*`(`/`(675675, 2048), `*`(`^`(t, 4))), `*`(`/`(43648605, 8192), `*`(`^`(t, 5))), `*`(`/`(...
series(`+`(1, `*`(`/`(3, 4), `*`(t)), `*`(`/`(105, 32), `*`(`^`(t, 2))), `*`(`/`(3465, 128), `*`(`^`(t, 3))), `*`(`/`(675675, 2048), `*`(`^`(t, 4))), `*`(`/`(43648605, 8192), `*`(`^`(t, 5))), `*`(`/`(...
series(`+`(1, `*`(`/`(3, 4), `*`(t)), `*`(`/`(105, 32), `*`(`^`(t, 2))), `*`(`/`(3465, 128), `*`(`^`(t, 3))), `*`(`/`(675675, 2048), `*`(`^`(t, 4))), `*`(`/`(43648605, 8192), `*`(`^`(t, 5))), `*`(`/`(...
series(`+`()+O(`^`(t, 15)),t,15) (4.1.8)