︠886405b2-7132-488c-9ad7-d3a790ddc9c1i︠ %html
This worksheet demonstrates how to compute top intersections on Deligne-Mumford compactification of the moduli space of curves using Sage code written by Drew Johnson. A pdf description of the algorithms can be found in the BitBucket repository (see link below). If you have any questions or problems, or if you find the code useful, please contact the author by email .
If you accessed this worksheet online, you are probably viewing a read-only version. If you would like to use the code yourself, you have the following options.
I worked on this project as a graduate student at Brigham Young University while being funded by the NSA grant of my adviser, Tyler Jarvis. Dr. Jarvis also answered many questions and pointed me to helpful resources during this project. The mathematical basis of the algorithms implemented here come from the paper accompanying Carel Faber's Maple code, and also from Stephanie Yang's write up about her Macaulay 2 code. The code computes the Witten tau function using the recursion of Liu and Xu.
︡62c17777-5bbf-4d25-82f2-b42716949f9e︡{"html":"This worksheet demonstrates how to compute top intersections on Deligne-Mumford compactification of the moduli space of curves using Sage code written by Drew Johnson. A pdf description of the algorithms can be found in the BitBucket repository (see link below). If you have any questions or problems, or if you find the code useful, please contact the author by email .\n\n
\nIf you accessed this worksheet online, you are probably viewing a read-only version. If you would like to use the code yourself, you have the following options.\n
I worked on this project as a graduate student at Brigham Young University while being funded by the NSA grant of my adviser, Tyler Jarvis. Dr. Jarvis also answered many questions and pointed me to helpful resources during this project.\n \nThe mathematical basis of the algorithms implemented here come from the paper accompanying Carel Faber's Maple code, and also from Stephanie Yang's write up about her Macaulay 2 code. The code computes the Witten tau function using the recursion of Liu and Xu.
\n\n"}︡ ︠86614ee1-a478-404b-a441-5da506732aeaasr︠ %auto URL_PATH = 'https://bitbucket.org/drew_j/top-intersections-on-mbar_g-n/raw/tip/' FILES = ["LazyAttr.py", "remember.py", "push_down.py", "exprwdata.py", "richcomparisonmixin.py", "TautRing3.py", "tau.py", "intersection7.py", "intersection_ui.py"] for f in FILES: load(URL_PATH + f) #change this line if you want to load a local copy print "Files loaded." ︡9af53990-6a22-4694-b0b4-6384896c96ef︡ ︠93789840-0520-4c15-a124-95b03ed738f1i︠ %htmlYou can use the space command to set the space you are working in. The first argument is the genus, and the last is the number of marked points. The space command does three things:
You can use the space command to set the space you are working in. The first argument is the genus, and the last is the number of marked points. The space command does three things:\n
The class Dg1m1 is the class corresponding to the reducible boundary divisor where one component has genus 1 and the marked point 1. The class irr corresponds to the class of the irreducible boundary divisor. The classes psi, ka, ch, and la represent psi, kappa, chern character, and lambda classes respectively.
Now we are ready to compute some things. You can type in a polynomial in the classes given by the space command: ︡c939d171-8f7f-40ae-8dfa-ac5e8e61e3e5︡{"html":"
The class Dg1m1 is the class corresponding to the reducible boundary divisor where one component has genus 1 and the marked point 1. The class irr corresponds to the class of the irreducible boundary divisor. The classes psi, ka, ch, and la represent psi, kappa, chern character, and lambda classes respectively.\n\n
Now we are ready to compute some things. You can type in a polynomial in the classes given by the space command:\n\n"}︡
︠1e79cf33-dff3-44b3-82ed-bcce8ef0ac3e︠
intnum(irr^3*psi1)
︡662a1d0b-3e77-4084-a9d3-0811be3ae9f9︡{"stdout":"Computing the intersection of irr^3*psi1 over Mbar_2_1...\n-11/6\n"}︡
︠43584318-2c0b-4601-a8c7-35ebc37b3c8f︠
intnum(ka2^2)
︡af7f0067-eca8-4787-aca5-a09b3fc0f029︡{"stdout":"Computing the intersection of ka2^2 over Mbar_2_1...\n53/5760\n"}︡
︠129322ba-7ce1-4116-b8af-0c3c95bfdf75︠
intnum(3*irr^3*psi1 + 6*ka2^2)
︡7070b58f-e86d-44e0-84da-dfe69dda06cb︡{"stdout":"Computing the intersection of 3*irr^3*psi1 + 6*ka2^2 over Mbar_2_1...\n-5227/960\n"}︡
︠6e25c8e7-9b9c-4f14-948c-133d84de358ci︠
%html
If you are just computing a monomial with no coefficient, you can pass in the indexes as a list. Thus, the following command computes the same number as the first example above.
︡bc292782-6c7b-41fe-a947-9f4675a51545︡{"html":"If you are just computing a monomial with no coefficient, you can pass in the indexes as a list. Thus, the following command computes the same number as the first example above.\n\n"}︡
︠4d0a2b69-15b1-4764-8091-3d93088f5821︠
intnum([8,8,8,1])
︡1de72d14-9152-4c1a-897c-6b271a4ba176︡{"stdout":"Computing the intersection of irr^3*psi1 over Mbar_2_1...\n-11/6\n"}︡
︠67a87eec-adb7-4ed6-883d-253bd75a408di︠
%html
You can also specify the space you wish to work over in the function call. Any classes that are in the namespace will be interpreted as being in the space you specified. For example:
︡09f11491-e04e-4e49-ae9e-f6d94c847eea︡{"html":"You can also specify the space you wish to work over in the function call. Any classes that are in the namespace will be interpreted as being in the space you specified. For example:\n\n"}︡
︠6a15aed8-bcb1-4904-a9e5-33d139b5624a︠
intnum(2,2, psi1^5)
︡29a35cba-0be4-4680-a353-697db057750a︡{"stdout":"Computing the intersection of psi1^5 over Mbar_2_2...\n1/1152\n"}︡
︠41b311a3-c00a-4bf9-b3d0-dea176e8a692i︠
%html
The following syntax should be very similar to Carel Faber's MgnLb.txt Maple program:
︡a3b0afbb-5142-41b4-9c2d-c81a3a91d221︡{"html":"The following syntax should be very similar to Carel Faber's MgnLb.txt Maple program:\n\n"}︡
︠c1ab1f3f-d6bd-427a-86c5-e30987d3b041︠
intnum(2,2,[1,1,1,1,1])
︡7763cdc6-9926-48b9-9b4f-d2742d7fad48︡{"stdout":"Computing the intersection of psi1^5 over Mbar_2_2...\n1/1152\n"}︡
︠4de0125c-77ad-4ea0-bacc-6c9c37e06d24i︠
%html
However, in order to type in a polynomial in classes, the names must have been created by a previous space command. Thus, if you have not called space with marked points at least 2 in this session, the following will give an error:
︡bb3ac429-19b5-4b98-a0dd-c2384ab73a8c︡{"html":"However, in order to type in a polynomial in classes, the names must have been created by a previous space command. Thus, if you have not called space with marked points at least 2 in this session, the following will give an error:\n\n"}︡
︠ebcdedf1-8a88-44a8-b41f-dd2789bceac1︠
intnum(2,2, psi1*psi2^4)
︡70b8b589-05cb-4dc5-a12b-451edff2f6d3︡{"stderr":"Error in lines 1-1\nTraceback (most recent call last):\n File \"/projects/16f34c24-934e-4ded-ab73-1bed36b35796/.sagemathcloud/sage_server.py\", line 879, in execute\n exec compile(block+'\\n', '', 'single') in namespace, locals\n File \"\", line 1, in Here are some of the intersection numbers from Faber's paper:
︡169c85c9-88af-48da-96de-bc14db5d90e3︡{"html":" Here are some of the intersection numbers from Faber's paper:\n\n"}︡
︠703fde61-526f-48ef-9a91-31af86bd7fd5︠
intnum(4,0, irr^9)
︡fd602447-8b53-44a8-bf02-1e4c8b7d195a︡{"stdout":"Computing the intersection of irr^9 over Mbar_4_0...\n-251987683/4320"}︡{"stdout":"\n"}︡
︠a098cfa8-c765-43ea-8353-ef9a95c8334a︠
intnum(4,0, la1^9)
︡b65b980b-2b29-4c49-bf2d-7bd0c515a2e9︡{"stdout":"Computing the intersection of la1^9 over Mbar_4_0...\n1/113400"}︡{"stdout":"\n"}︡
︠e4e2b66e-e9b0-475f-a581-632c9e594a14i︠
%html
To load a previously saved data file, use the following command:
︡b95145f6-ffcd-4564-a5bc-953851b00853︡{"html":"If you don't specify a file name, the data is saved to the file mgn_top_intersect.dat.\n\n To load a previously saved data file, use the following command:\n"}︡
︠decd1342-4ecb-4919-ab36-cf28ebb1d28b︠
load_data("testsave.dat")
︡456452cb-f768-4765-a4d0-3b2a7a307b28︡{"stdout":"Data loaded.\n"}︡
︠3ec2653a-397f-4f6c-88a1-8cd5fe5c42e9i︠
%html
(Note: If you save a data file in a worksheet, then you can find you data file in the Files tab.)
︡4b225f45-5f42-4464-9b38-0bc80d1f971f︡{"html":"(Note: If you save a data file in a worksheet, then you can find you data file in the Files tab.)\n\n"}︡
︠1cdade10-e266-425f-a0bc-6268b35dbf08︠
Some more examples
Some more examples
\n\n Options
You can suppress the helpful message that tells you what you are computing using the confirm keyword argument.
︡46719b35-fc3d-4f3e-a279-e48b4e0016a0︡{"html":" Options
\n\nYou can suppress the helpful message that tells you what you are computing using the confirm keyword argument.\n\n"}︡
︠6f61bb54-848e-4812-a509-3dd1733f4393︠
intnum(2,2,psi1^5, confirm = False)
︡c7d4c8d3-7fcb-4dca-b97c-3d05f6a20c89︡{"stdout":"1/1152\n"}︡
︠61f3164a-c3bb-4744-a876-b52d25b3e767i︠
%html
You can have the program return zero if the degree is wrong instead of raising an exception by using the check_degree keyword argument.
︡984ceb3c-3112-491b-93f1-9b38a09af0b2︡{"html":"You can have the program return zero if the degree is wrong instead of raising an exception by using the check_degree keyword argument.\n\n"}︡
︠3e1cbcea-cfea-424f-80e0-0fb36a493db4︠
intnum(2,2, psi1^2, check_degree = False)
︡c57b3c9d-0fef-487b-a9db-1247e8169d0c︡{"stdout":"Computing the intersection of psi1^2 over Mbar_2_2...\n0\n"}︡
︠e3436f37-274e-4f41-9875-89f9b6959472i︠
%html
Saving and loading
So far we have computed numbers from scratch. The program automatically saves any answers that it has computed in this session, including numbers computed in recursion steps. For example, if you computed the example la1^9 above, you probably noticed that it took a few seconds. If we compute it again, it will be really fast because the program just looks it up in a dictionary.
︡2a120c78-5014-4a3a-b638-2e4517dba7a8︡{"html":" Saving and loading
\n\nSo far we have computed numbers from scratch. The program automatically saves any answers that it has computed in this session, including numbers computed in recursion steps. For example, if you computed the example la1^9 above, you probably noticed that it took a few seconds. If we compute it again, it will be really fast because the program just looks it up in a dictionary.\n\n"}︡
︠2e457c9f-584f-4039-958f-c93cfc3c9d9c︠
timeit("intnum(4,0, la1^9)", number =1, repeat = 1)
︡e5d42e15-def9-45b6-95e8-3d3955dd40bd︡{"stdout":"1 loops, best of 1: 7.06 ms per loop\n"}︡
︠7e5ad3c9-b1c2-4716-8566-4f0cd85b504fi︠
%html
We can save this data to a file to avoid computing it over again in our next session.
︡462bc89f-0b72-40d3-bd2a-8b6f827e67fc︡{"html":"We can save this data to a file to avoid computing it over again in our next session.\n\n"}︡
︠7d988ca4-4b6f-44c8-a612-d94c1c04dcf8︠
save_data("testsave.dat")
︡14db5ed7-9727-4ab3-92de-42ab784772cd︡{"stdout":"Save suceeded.\n"}︡
︠f92a4ba3-628b-4879-a24d-4cf6046cdc3fi︠
%html
If you don't specify a file name, the data is saved to the file mgn_top_intersect.dat.