Mathematical Field Notes

Archive for the ‘Code’ Category

Using graphviz to illustrate course structure

leave a comment »

At some point last year, I got frustrated that I couldn’t see easily the global structure of the UCL undergraduate maths course without trawling through a bunch of PDFs, so I made this webpage:

to illustrate it. Hopefully some people have found this useful in deciding which modules to choose or in advising students which modules to take.

To generate the image maps I used a fantastic programme called graphviz. In case anyone wants to adapt what I did to their own ends, I have made my graphviz code for these diagrams (plus some ancillary shells scripts for creating and uploading the webpage) available here:

For more details, see the readme file.


Written by Jonny Evans

October 22, 2015 at 11:35 pm

E-Learning: Spring 2013

leave a comment »

Henry Wilton, Bonita Carboo and I are the UCL Maths Department’s e-learning reps. In the interests of sharing ideas, here are a few things I have discovered this Spring about e-learning which may be useful to others.


Moodle is the online platform UCL uses to interact with its students. I am only just waking up to the possibilities it offers.

Most importantly for mathematicians, Moodle has LaTeX functionality. You may not discover it immediately, because the syntax is a little strange: you need to surround your LaTeX by double dollar signs, e.g. $$\sin(x)$$. This acts as if it were single dollar signs in ordinary LaTeX.

I was initially unconvinced of the utility of online forums for students, but that changed drastically. I had a feeling that students wouldn’t use them, but I decided to give it a go. I was being asked many questions by email, many of which were duplicates, so I created a forum for the students to ask questions during exam term. If I was emailed a question, I didn’t answer it and instead strongly encouraged the student to ask on the Moodle forum. The result was a big uptake of the forum with sixteen threads involving posts from sixteen different students in the month leading up to the exam. This is only 10% of the class, but I was able to point others who asked questions by email to the answers I had posted on the forum, saving me time. If I had realised earlier how effective this would be, I would have introduced a forum from the outset.

You can see stats on how many views your forum is getting by going to Navigation > Reports > Logs (thanks to Fiona Harkin for pointing this out). The revision forum had had 2491 views in just over a month. I would say this has been an extremely effective tool: while it was a lot of work to answer all the questions, that work counted for more.


Sage is an open-source computer algebra program. You can run it online using the Sage Notebook if you have an OpenID or using the Sage Cell Server which allows you to run small scripts without the bother of signing in. You can even embed it into webpages to create interactive content.

One of the biggest problems my students had was getting practice calculating Fourier series, so I have written the bare bones of a short (easily extendable) interactive webpage for next year which should give them the practice they need. I will add more examples to this (if and) when I have time. If you want to see how the page works, you can see the Sage code embedded in the HTML by viewing the page source. The important things are the script tags in the document head.

E-learning development grant

I am now the proud owner of an e-learning development grant to facilitate the filming of mathematics lectures and make them available online. I will expand on this in a blog post of its own.

Written by Jonny Evans

June 27, 2013 at 8:32 am

Posted in Code, E-learning, Teaching

TikZ code for the octahedral axiom

with one comment

If anyone finds it useful, I’ve created a LaTeX command for drawing the octahedral axiom (requires the TikZ package) based on this example of Stefan Kottwitz. You can easily edit the code to add labels to arrows (they would go in the empty brackets in the lines that say “edge”) or add these as extra arguments to the function.

Include the following code in the head of your LaTeX document:


\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2cm,

  \node (1) {$#1$};
  \node (4) [below right of=1] {$#4$};
  \node (6) [below right of=4] {$#6$};
  \node (2) [above right of=4] {$#2$};
  \node (5) [above right of=6] {$#5$};
  \node (3) [above right of=5] {$#3$};

    (1) edge [out=25,in=155] node [right] {} (3)
        edge node[right] {} (2)
    (2) edge node [right] {} (3)
        edge node[right] {} (4)
    (3) edge node [right] {} (5)
        edge [out=270,in=0] node [right] {} (6)
    (4) edge node [right] {} (6)
    (6) edge node [right] {} (5);
    (4) edge node[right] {} (1)
    (5) edge node[right] {} (4)
        edge node[right] {} (2)
    (6) edge [out=180,in=270] node [right] {} (1);

Then the command \Octa{X}{Y}{Z}{A}{B}{C} will produce a diagram like this:

The octahedral axiom for taking the cone of a composition.

The octahedral axiom for taking the cone of a composition.

Written by Jonny Evans

March 1, 2013 at 11:37 am