Tripos Bot
From charlesreid1
Contents
Overview
The Tripos Bot posts really, really difficult math problems. The source of these problems is the Cambridge Mathematics Tripos, principally drawn from those presented by G. H. Hardy in his work A Course of Pure Mathematics, available on Gutenberg: https://www.gutenberg.org/ebooks/38769
Notes
Concept
Tripos bot:
- Tweets one problem per week
- One image per problem
- Images come from Latex, rendered with "index card" class, converted to image (one-time, offline)
- Depending on number of Tripos problems: can definitely find 52, but not sure if I can find 365
- If we can find 365, then one per day...
Source Material
Hardy's Course of Pure Mathematics:
- Around 210 Tripos problems - still need another 150 or so.
This should round it out:
Git Code Repository
Code: https://git.charlesreid1.com/charlesreid1/tripos-bot
Latex
Gutenberg offers a Latex version of Hardy's Course of Pure Mathematics: https://www.gutenberg.org/ebooks/38769
This means the problems appear like this:
If $a$, $b$, $x$, $y$ are rational numbers such that \[ (ay - bx)^{2} + 4(a - x)(b - y) = 0, \] then either (i)~$x = a$, $y = b$ or (ii)~$1 - ab$ and~$1 - xy$ are squares of rational numbers. \MathTrip{1903.}
There are a few macros from the Latex version that need to be included when the problems are compiled with Latex.
Sample Latex Problem
Each problem is relatively minimal as far as Latex code. Here is an example problem:
Sum the series \[ \frac{x}{2! \DPchg{n - 2!}{(n - 2)!}} + \frac{x^{2}}{5! \DPchg{n - 5!}{(n - 5)!}} + \frac{x^{3}}{8! \DPchg{n - 8!}{(n - 8)!}} + \dots + \frac{x^{n/3}}{\DPchg{n - 1!}{(n - 1)!}}, \] $n$~being a multiple of~$3$. \MathTrip{1899.}
This uses a macro \DPchng
that must be defined. This and other macros drawn from the Gutenberg version of the book are included in the main Latex template, which is used as a wrapper around each problem's minimal Latex code.
Here is the template:
\documentclass[]{article} \usepackage{blindtext} \usepackage{amsmath} \usepackage[active, tightpage]{preview} \setlength\PreviewBorder{10pt}% \pagenumbering{gobble} \newcommand{\btw}{\mathbin{)\kern-5pt(}} \newcommand{\dd}{\partial} \newcommand{\tsum}{{\textstyle\sum}} \newcommand{\ds}{\displaystyle} \renewcommand{\limsup}{\varlimsup} \renewcommand{\liminf}{\varliminf} %% Named operators \DeclareMathOperator{\ArcCos}{arc\,cos} \DeclareMathOperator{\ArcCosec}{arc\,cosec} \DeclareMathOperator{\ArcCot}{arc\,cot} \DeclareMathOperator{\ArcSec}{arc\,sec} \DeclareMathOperator{\ArcSin}{arc\,sin} \DeclareMathOperator{\ArcTan}{arc\,tan} \DeclareMathOperator{\cosec}{cosec} \DeclareMathOperator{\sech}{sech} \DeclareMathOperator{\cosech}{cosech} \DeclareMathOperator{\argcosh}{arg\,cosh} \DeclareMathOperator{\argcoth}{arg\,coth} \DeclareMathOperator{\argsinh}{arg\,sinh} \DeclareMathOperator{\argtanh}{arg\,tanh} \newcommand{\arccosec}{\ArcCosec} \newcommand{\arccot}{\ArcCot} \newcommand{\arcsec}{\ArcSec} \renewcommand{\arccos}{\ArcCos} \renewcommand{\arcsin}{\ArcSin} \renewcommand{\arctan}{\ArcTan} \DeclareMathOperator{\Cis}{Cis} \DeclareMathOperator{\Log}{Log} \DeclareMathOperator{\sgn}{\textit{sgn}\,} \DeclareMathOperator{\am}{am} \DeclareMathOperator{\Real}{\mathbf{R}} \DeclareMathOperator{\Imag}{\mathbf{I}} \renewcommand{\Re}{\Real} \renewcommand{\Im}{\Imag} %%% % Handle degree symbols and centered dots as Latin-1 characters %%% \DeclareInputText{176}{\ifmmode{{}^\circ}\else\textdegree\fi} %%% \DeclareInputText{183}{\ifmmode\cdot\else\textperiodcentered\fi} % Local spacing coercion \newcommand{\Loosen}{\spaceskip 0.375em plus 0.75em minus 0.25em} % Used only once, to coax a wide display into the text block \newcommand{\Squeeze}[2][0.98]{\scalebox{#1}[1]{#2}} % Allow \quad to compress a bit \let\oldquad=\quad \renewcommand{\quad}{\oldquad\hspace{0pt minus 3pt}} \newcommand{\Medskip}{\vspace{0pt plus 0.5\baselineskip}} %% Parametrized vertical space %% \newcommand{\Strut}[1][12pt]{\rule{0pt}{#1}} %%%% Corrections and in-line transcriber's notes %%%% % In-line notes \newcommand{\DPnote}[1]{} % Errors \newcommand{\DPtypo}[2]{#2} %%%% Notational modernizations %%%% % ** If \epsilon -> \varepsilon, figures p117 and p176 must be recompiled % Modernize TRUE % Stylistic changes made for clarity or consistency \newcommand{\DPchg}[2]{#2} \newcommand{\Add}[1]{#1} % Modernize notation \newcommand{\DPmod}[2]{#2} % ** Incarnations of \sqrt; see below for significance \newcommand{\sqrtp}[2][\ ]{\sqrt[#1]{#2}} \newcommand{\sqrtb}[2][\ ]{\sqrt[#1]{#2}} \newcommand{\sqrtbr}[2][\ ]{\sqrt[#1]{#2}} \newcommand{\bigsqrt}[2][\ ]{\sqrt[#1]{#2}} \newcommand{\bigsqrtb}[2][\ ]{\sqrt[#1]{#2}} \newcommand{\bigsqrtp}[2][\ ]{\sqrt[#1]{#2}} % Exchange delta, epsilon in the definition of limits \newcommand{\DELTA}{\epsilon} \newcommand{\EPSILON}{\delta} % Add visual delimiters to large integers/long decimals \newcommand{\MC}{,}% "Math comma" \newcommand{\MS}{\,}% "Math space" %%% %%% % Modernize FALSE %%% \newcommand{\DPchg}[2]{#1} %%% \newcommand{\Add}[1]{} %%% \newcommand{\DPmod}[2]{#1} %%% % Use surd sign... %%% \let\oldsqrt=\sqrt% %%% \renewcommand*{\sqrt}[2][\ ]{\oldsqrt[#1]{\vphantom{|}}#2} %%% % ... with parentheses or curly braces around radicand %%% \newcommand{\sqrtp}[2][\ ]{\sqrt[#1]{(#2)}} %%% \newcommand{\sqrtb}[2][\ ]{\sqrt[#1]{\{#2\}}} %%% \newcommand{\sqrtbr}[2][\ ]{\sqrt[#1]{\,[#2]}} %%% \newcommand{\bigsqrt}[2][\ ]{\oldsqrt[#1]{\vphantom{#2}}#2} %%% \newcommand{\bigsqrtb}[2][\ ]{\oldsqrt[#1]{\vphantom{\bigg|}}\left\{#2\right\}} %%% \newcommand{\bigsqrtp}[2][\ ]{\oldsqrt[#1]{\vphantom{#2}}\!\!\left(#2\right)} %%% %%% \newcommand{\DELTA}{\delta} %%% \newcommand{\EPSILON}{\epsilon} %%% % Don't add visual delimiters to large integers/long decimals %%% \newcommand{\MC}{} %%% \newcommand{\MS}{} \newcommand{\MathTrip}[1]{% \pagebreak[0]% \hfil\allowbreak\null\nobreak\hfill\nobreak\mbox{(\textit{Math.\ Trip.}\ #1)}% \pagebreak[1]% } \begin{document} \begin{preview} \input{FILENAME} \end{preview} \end{document}
Planning
January 2018
Task List
Task list:
Work out small page latexGet questions into latex formatScript to compile latex to pdf, Imagemagick latex to jpgCreate Rainbow Mind Machine botFix up rainbow mind machine image tweetsWrite custom Sheep for daily tweet schedule from image directory- Create Twitter account
- Authenticate
- Set up and run on Rojo
Timeline:
Task 1: Extracting all tripos problems into Latex. 25 minutes
Task 3A: Compile Latex to pdf, ImageMagick pdf to jpg. Set up templating system for Latex. Use sed and \input{FILENAME}
. 25 minutes
Task 3B: Fix Latex errors, broken macros, etc. 60 minutes
Task 2: Keep it simple, define bot items as a single image, same text different images each time (TBA)
Task 4: Will take some experimenting, but pretty sure Rainbow Mind Machine has multimedia tweeting already (TBA)