Skip to content

Instantly share code, notes, and snippets.

@davidlowryduda
Last active December 4, 2023 15:07
Show Gist options
  • Save davidlowryduda/1ef4c91d00c3c23da9b93bbb39981fef to your computer and use it in GitHub Desktop.
Save davidlowryduda/1ef4c91d00c3c23da9b93bbb39981fef to your computer and use it in GitHub Desktop.
SageAndTheLMFDB
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"id": "3b9cf202",
"metadata": {},
"source": [
"# The LMFDB and Sage\n",
"\n",
"## Making data and programs available\n",
"\n",
"The [LMFDB](https://www.lmfdb.org/) is the **L-Functions and Modular Forms Database**, a database of math objects appearing in number theory, represention theory, and the [Langlands program](https://en.wikipedia.org/wiki/Langlands_program).\n",
"\n",
"This includes databases on \n",
"\n",
"- modular forms\n",
"- number fields\n",
"- elliptic curves\n",
"- abelian varieties\n",
"- connections between these\n",
"- and more\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "ea03f5bb",
"metadata": {},
"source": [
"## Examples!\n",
"\n",
"Let's look at the [LMFDB](https://www.lmfdb.org/universe).\n",
"\n",
"- LHS has links to top-level databases, like [elliptic curves over $\\mathbb{Q}$](https://www.lmfdb.org/EllipticCurve/Q/).\n",
"- To get a feel, try clicking on options giving a *random page*.\n",
"- Knowls\n",
"- Related objects (like L-functions)\n",
" * Some objects, like the [11a1](https://www.lmfdb.org/EllipticCurve/Q/11/a/1) elliptic curve, have more related objects, including [a modular form](https://www.lmfdb.org/ModularForm/GL2/Q/holomorphic/11/2/a/a/).\n",
" * A major goal of the LMFDB is to expose known relations\n",
" * And offer experimental evidence for more\n",
"- Click on lots of things!\n",
"- (For a preview of upcoming developments, you can go to [beta.lmfdb.org](https://beta.lmfdb.org/)). "
]
},
{
"cell_type": "markdown",
"id": "87c6f656",
"metadata": {},
"source": [
"## Goals and Considerations\n",
"\n",
"The LMFDB tries to be\n",
"\n",
"- easily accessible online\n",
"- correct and rigorous (see *reliability*)\n",
"- based on verifiable research (see *source and acknowledgements*)\n",
"- understandable, with glossaries and annotations\n",
"- searchable! (See also statistics)\n",
"- copy-and-pasteable\n",
"- useful! [See citations](https://www.lmfdb.org/citation)"
]
},
{
"cell_type": "markdown",
"id": "49557d8c",
"metadata": {},
"source": [
"## History\n",
"\n",
"- Grew out of an AIM workshop in 2007. (Thanks AIM!)\n",
"- Until 2013, the LMFDB was hosted by William Stein on an NSF-supported cluster at the University of Washington.\n",
"- From 2013 to 2016, the LMFDB was hosted at the University of Warwick and the University of Bristol, supported by an EPSRC grant.\n",
"- From 2016 to 2017, it was supported by a CompX grant awarded to Edgar Costa and John Voight\n",
"- Since 2017, the LMFDB is hosted on Google Cloud instead of a single university. Until next year, it's supported by the Simons Foundation.\n",
"\n",
"The LMFDB has survived changes in leadership (so deadly to young organizations)."
]
},
{
"cell_type": "markdown",
"id": "73978b3c",
"metadata": {},
"source": [
"## Present\n",
"\n",
"The LMFDB organization is now structured [similar to a journal](https://www.lmfdb.org/management), with managing editors (John Cremona, John Jones, John Voight, Drew Sutherland) and associate editors (including several people here: Edgar Costa, David Farmer, Kiran Kedlaya, David Roe).\n",
"\n",
"Contributions and requests filter through the editorial board.\n",
"\n",
"### Informal Infrastructure\n",
"\n",
"In practice, we have a set of less formal tools that are useful for helping new contributors and users. These include\n",
"\n",
"- weekly (approximately) development meetings, **LMFDB Fridays**.\n",
"- email lists\n",
"- zulip chat\n",
"- structured, thematic workshops on particular topics\n",
"\n",
"Over $100$ [people](https://www.lmfdb.org/acknowledgment) have contributed to the LMFDB."
]
},
{
"cell_type": "markdown",
"id": "21b3fd1b",
"metadata": {},
"source": [
"# The LMFDB is written in sage\n",
"\n",
"## Sage is written (mostly) in python\n",
"\n",
"The source for the site is [on github](https://github.com/LMFDB/lmfdb).\n",
"So is the [source for sage](https://github.com/sagemath/sage).\n",
"\n",
"It is *unusual* that the LMFDB is written in sage, as [sage (= SageMath)](https://www.sagemath.org/) is a computer algebra system.\n",
"\n",
"William Stein, 2005.\n",
"\n",
"> **Sage's Mission**: Creating a viable free open source alternative to Magma, Maple, Mathematica and Matlab.\n",
"\n",
"There are many parallels between sage and the LMFDB. Sage stands on the shoulders of giants, and tries to unify [many different pieces of free and open source software](https://doc.sagemath.org/html/en/reference/spkg/).\n",
"\n",
"Now there is a lot of math software written directly in sage (like the LMFDB)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "028c6164",
"metadata": {},
"outputs": [],
"source": [
"print(\"Hello, world!\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "baff8ff1",
"metadata": {},
"outputs": [],
"source": [
"def say_hi(name):\n",
" print(f\"Hi {name}!\")\n",
" \n",
"say_hi(\"AIM\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "da2572a0",
"metadata": {},
"outputs": [],
"source": [
"(1 + 2)^2 - 3"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a06db838",
"metadata": {},
"outputs": [],
"source": [
"e^(i*pi)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "00c9d256",
"metadata": {},
"outputs": [],
"source": [
"a = e^(i*pi/3)\n",
"print(a)\n",
"b = a^3\n",
"print(b)\n",
"print(b.expand())"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bd4b6578",
"metadata": {},
"outputs": [],
"source": [
"f = (1 + x)*(x^2 - x - 1)\n",
"f.expand()"
]
},
{
"cell_type": "markdown",
"id": "80d58c44",
"metadata": {},
"source": [
"Sage plays the role of a CAS *written in a useful language*. (I wouldn't want to write a webserver in Mathematica, for example)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b9213595",
"metadata": {},
"outputs": [],
"source": [
"# Suppose we wanted to experiment with an elliptic curve.\n",
"# https://www.lmfdb.org/EllipticCurve/Q/ --> rank 1 (say)\n",
"# sage: E = EllipticCurve([0, 0, 1, -1, 0])\n",
"\n",
"E = EllipticCurve([0, 0, 1, -1, 0])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "034992bb",
"metadata": {},
"outputs": [],
"source": [
"# Sage has strong introspection: pressing <TAB> tries to\n",
"# give a useful set of autocompletions\n",
"#\n",
"# Typing `E.<TAB>` for example\n",
"# Then you can use `?<ENTER>` for more help.\n",
"\n",
"#E."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "916d4ac1",
"metadata": {},
"outputs": [],
"source": [
"# And it can still do CAS things, like adding points on elliptic curves\n",
"g = E.gens()[0]\n",
"10 * g"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fa8e8c8e",
"metadata": {},
"outputs": [],
"source": [
"# The LMFDB tries to give as much relevant sage code as\n",
"# possible. For example, a random Dirichlet character page\n",
"# such as https://www.lmfdb.org/Character/Dirichlet/82900/es\n",
"# lets us reconstruct the character.\n",
"\n",
"from sage.modular.dirichlet import DirichletCharacter\n",
"H = DirichletGroup(82900, base_ring=CyclotomicField(92))\n",
"M = H._module\n",
"chi = DirichletCharacter(H, M([0,23,20]))\n",
"chi"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d7430765",
"metadata": {},
"outputs": [],
"source": [
"# chi.lmfdb_page()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5c1a71f0",
"metadata": {},
"outputs": [],
"source": [
"# chi(3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0ff374d6",
"metadata": {},
"outputs": [],
"source": [
"# G = chi.parent()\n",
"# G"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c07f8478",
"metadata": {},
"outputs": [],
"source": [
"# G.cardinality()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "26e11d92",
"metadata": {},
"outputs": [],
"source": [
"# G[3] * G[7]"
]
},
{
"cell_type": "markdown",
"id": "7f80c643",
"metadata": {},
"source": [
"Stepping away from number theory examples, sage can do typical CAS things."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5810c7dc",
"metadata": {},
"outputs": [],
"source": [
"u = var('u')\n",
"diff(sin(u), u)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a4ac51e2",
"metadata": {},
"outputs": [],
"source": [
"diff(cos(u) * sin(u), u)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5cdcad6b",
"metadata": {},
"outputs": [],
"source": [
"diff(sin(u) * u^2, u, 4)"
]
},
{
"cell_type": "markdown",
"id": "0c815ac3",
"metadata": {},
"source": [
"Sage has excellent plotting utilities."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b9afabf1",
"metadata": {},
"outputs": [],
"source": [
"plot(sin, (-10, 10))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fb3bfa27",
"metadata": {},
"outputs": [],
"source": [
"complex_plot(sin, (-5, 5), (-5, 5), cmap=\"cividis\", contoured=True, plot_points=500)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a7972180",
"metadata": {},
"outputs": [],
"source": [
"m = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "41ca48f0",
"metadata": {},
"outputs": [],
"source": [
"latex(m)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "645f8658",
"metadata": {},
"outputs": [],
"source": [
"latex(m^2)"
]
},
{
"cell_type": "markdown",
"id": "e4755205",
"metadata": {},
"source": [
"## To learn more about sage\n",
"\n",
"First, get access to a computer with sage. (You can install it yourself for free. Alternately, you can use [CoCalc](https://cocalc.com/), which has a free online interface to sage).\n",
"\n",
"Then I suggest opening a jupyter notebook like this, clicking on `Help`, and beginning with one of\n",
"\n",
"- `Tutorial`\n",
"- `Thematic Tutorials`\n",
"- `PREP Tutorials`\n",
"\n",
"These can also be found at the [SageMath website documentation](https://doc.sagemath.org/)."
]
},
{
"cell_type": "markdown",
"id": "19018f52",
"metadata": {},
"source": [
"## Informal infrastructure supporting sage\n",
"\n",
"Sage development is larger and more distributed than LMFDB development. Several mathematicians have contributed to both. As an organization, there is a core team (including David Roe), several established repeat contributors, and hundreds of occasional contributors.\n",
"\n",
"Discussion occurs largely through\n",
"\n",
"- mailing lists\n",
"- a zulip chat\n",
"- [SageDays workshops](https://wiki.sagemath.org/Workshops)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "SageMath 10.0.rc1",
"language": "sage",
"name": "sagemath"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment