From 9c838f680020c8116637925d2c1ddd0bf73d7d01 Mon Sep 17 00:00:00 2001 From: Luke Naylor <l.naylor@sms.ed.ac.uk> Date: Tue, 14 Mar 2023 23:53:39 +0000 Subject: [PATCH] Have first sage plot working --- .gitignore | 3 ++ Makefile | 37 +++++++++++++++++ main.tex | 13 +++++- sagetexscripts/fig1.sage | 89 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 Makefile create mode 100644 sagetexscripts/fig1.sage diff --git a/.gitignore b/.gitignore index 3f41c5a..991411d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ main* !main.tex +sage-plots-for-main.tex/* +**/__pycache__/ +sagetexscripts/*.py diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dce39f7 --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +# Requires GNU make, xargs, a latex distribution, sage +# and sagetex.sty visible in TEXINPUTS + +MAINTEXFILE = main.tex +TEXFILES = ${MAINTEXFILE} +SAGESCRIPT = main.sagetex.sage +SAGEPLOTFILES = sagetexscripts/fig1 + +main.pdf: ${TEXFILES} main.sagetex.sout + latexmk + +main.sagetex.sout: ${SAGESCRIPT} pymodules + sage $? + +${SAGESCRIPT}: ${TEXFILES} + pdflatex -interaction=nonstopmode ${MAINTEXFILE} + +pymodules: $(addsuffix .py,${SAGEPLOTFILES}) + +$(addsuffix .py,${SAGEPLOTFILES}): $(addsuffix .sage,${SAGEPLOTFILES}) + # Preparse Sagemath scripts in sagetexscripts, + # converting them to python files of form <basename>.py + # (ready to be imported as python modules) + sage --preparse $^ + echo ${SAGEPLOTFILES} | xargs -I % sh -c 'mv %.sage.py %.py' + +.PHONY: clean +clean: + latexmk -C + rm -f main.pdf + rm -f *.sagetex.* + rm -f *.xml + rm -f *.sta + rm -f *.bbl + rm -rf sage-plots-for-main.tex + rm -f *.tmp + diff --git a/main.tex b/main.tex index 409c773..00b53a7 100644 --- a/main.tex +++ b/main.tex @@ -7,6 +7,7 @@ \usepackage{amsmath} \usepackage{amsfonts} \usepackage{mathtools} +\usepackage{sagetex} \usepackage{ulem} \usepackage{xcolor} @@ -16,7 +17,7 @@ \title{Bridgeland Stabilities and Finding Walls} \subtitle{} \author{Luke Naylor} -\institute{University of Edinburgh} +\institute{Hodge Club} \date{March 2023} \newcommand\RR{\mathbb{R}} @@ -32,7 +33,7 @@ \titlepage \end{frame} -\section{Transitioning to Stab on $D^b(X)$} +\section{Transitioning to Stab on Triangulated Categories} \begin{frame}{Central Charge} \begin{align*} @@ -41,6 +42,14 @@ \end{align*} \end{frame} +\begin{sagesilent} + import sagetexscripts.fig1 +\end{sagesilent} + +\begin{frame}{plot} + \sageplot{sagetexscripts.fig1.plot()} +\end{frame} + \section{Section 1} \section{Section 2} diff --git a/sagetexscripts/fig1.sage b/sagetexscripts/fig1.sage new file mode 100644 index 0000000..30a5826 --- /dev/null +++ b/sagetexscripts/fig1.sage @@ -0,0 +1,89 @@ +#!/usr/bin/env sage + +from pseudowalls import * + +def plot(): + O = Chern_Char(1,0) + O1 = exponential_chern(1,1) + O1inv = exponential_chern(-1,1) + O2 = O1 * O1 + O_x = Chern_Char(0,1) + + def plot_central_charge(chern, name, argument = None, radius = None): + Z = stability.Mumford().central_charge(chern) + x = Z.real() + y = Z.imag() + + if not argument: + argument = arctan(y/x) if x != 0 else pi / 2 + if argument <= 0: + argument += pi + + if not radius: + radius = (pi-argument/2)/pi + + return point( + Z, + marker = "o", + size = 600, + rgbcolor = "white", + #markeredgecolor = "purple", + zorder = 100 + ) + point( + Z, + marker = name, + size = 500, + rgbcolor = "red", + zorder = 101 + ) + line( + (0, Z), + rgbcolor = "red", + linestyle = "dashed", + zorder = 99 + ) + disk( + (0,0), + float(radius), + (0, float(argument)), + alpha=.2, + fill=False, + thickness=1, + rgbcolor="purple" + ) + + p = sum( + plot_central_charge(chern, name) + for chern, name in [ + (O1, r"$\mathcal{O}(1)$"), + (O, r"$\mathcal{O}_X$"), + (O1inv, r"$\mathcal{O}(-1)$"), + (O2, r"$\mathcal{O}(2)$"), + (O_x, r"$\mathcal{O}_p$") + ] + ) + + xmax = (2.5) + xmin = (-2.5) + ymin = (-0.25) + ymax = (1.5) + aspect_ratio = (1) + + p += polygon( + [ + (xmax + 1,0), + (xmin - 1,0), + (xmin - 1,ymax + 1), + (xmax + 1,ymax + 1) + ], + rgbcolor = "yellow", + alpha = 0.2, + zorder = 102 + ) + + p.xmax(xmax) + p.xmin(xmin) + p.ymin(ymin) + p.ymax(ymax) + p.set_aspect_ratio(aspect_ratio) + + p.axes_labels([r"$\mathcal{R}$",r"$\mathcal{I}$"]) + return p -- GitLab