## Using Overleaf for student papers

In my introductory differential equations course, I assign students to write several papers. I require the students to typeset their papers with LaTeX, and to use graphics imported from Mathematica.

This semester, the paper assignments are:

• Equilibrium solutions for the logistic model. This first assignment is mathematically extremely simple. The purpose is to give the students experience with LaTeX typesetting, with generating plots using Mathematica, and with paper writing in a technical setting.
• Comparing harvesting models. In this assignment student compare/contrast two different ways to modify the logistic model in order to account for harvesting. The purpose is to for students to think more deeply about the assumptions that go in to the models and about the predictions that the models make.
• Predator-prey models. In this assignment students are explore a simple predator-prey system with variable coupling. The purpose of this assignment is for students to discover the bifurcation points of the system, and to interpret the bifurcation in the context of population modeling.
• Gravitation. In this assignment, students study a small body orbiting a larger body according to Newtonian mechanics. The purpose is for the students to learn how to apply, and interpret, conserved quantities.

In all of these assignments, I want students to become proficient with LaTeX and to develop technical writing skills. I also want the students to become familiar with the process of using multiple pieces of software in order to create a single product.

One of the challenges associated to these assignments is getting LaTeX typesetting software up and running on whatever device students are using. The Mac labs on our campus all have the excellent (and free) TeXShop program installed, but it was a bit of a hassle getting  appropriate software installed on the students’ personal machines.

Fortunately, I discovered Overleaf, which allows students to write and compile LaTeX via a web browser, and to store their papers on a server in the cloud. Thus far, the advantages of using Overleaf are

• All students, regardless of which machine or operating system they use, are using the same software.
• Students can access their projects from any machine.
• I can use Overleaf to share a template (requires this graphic file) for the students to use.

The main disadvantage of Overleaf seems to be that processing speed is sometimes slow. This is due to the fact that the compiling is happening remotely. Thus far, it has not been a large issue.

This semester I devoted one full class day to showing students how to use Overleaf, and giving them a quick introduction to LaTeX. Students also worked through a self-paced module that introduced them to Mathematica. This took place in the computer lab, and seemed to work very well.

A second day was spent discussing elements of writing that are specific to math. This included a discussion of document structure, as well as conventions (not starting sentences with symbols, making all mathematics part of a sentence, etc.).

These two days, together with the detailed feedback I gave on the first assignment, seemed to be sufficient to get most students up and running with LaTeX and mathematical writing.

## Mathematica — Euler’s method for systems, revisited

An earlier post discusses Mathematica code for Euler’s method. Here is some updated code.

A couple preliminary notes:

• I like to clear all variables at the beginning.
• For systems it is fun to superimpose the plot on top of the stream plot of the corresponding vector field

Example 1
For the IVP $\frac{dy}{dt} = t-y$, $y(0) = 2$ with $\Delta t = 0.1$ we can use the code

Clear["Global*"]
f[t_, y_] := t - y
deltat = 0.1;
eulerValues =
RecurrenceTable[{t[k + 1] == t[k] + deltat,
y[k + 1] == y[k] + deltat*f[t[k],y[k]],
t == 0.,
y == 2.},
{t, y}, {k, 0, 10}];
Grid[eulerValues]
eulerPlot=ListLinePlot[eulerValues, PlotMarkers -> Automatic]
realPlot = Plot[3 Exp[-t] + t - 1,
{t, 0, 1}, PlotStyle -> Red];
Show[eulerPlot, realPlot]


Example 2
Consider $\frac{dy}{dt} = e^y$, $y(0)=1$, $\Delta t = .25$
We use

Clear["Global*"]
deltat = .05;
f[y_] := Exp[y];
values = RecurrenceTable[{
t[k + 1] == t[k] + deltat,
y[k + 1] == y[k] + deltat*f[y[k]],
t == 0, y == 1
}, {t, y}, {k, 0, 10}];
Grid[values]
ListLinePlot[values, PlotMarkers -> Automatic]


Example 3
Here we consider the system $\frac{dx}{dt} = x(1-x) - xy$ $\frac{dy}{dt} = -y + 2 xy$
with $\Delta t = 0.1$ and initial conditions $x(0) = 1.5, y(0) = 1$. The following code processes the first 100 time steps.

Clear["Global*"]

f[x_, y_] := x (1 - x) - x*y
g[x_, y_] := -y + 2 x*y
streamPlot = StreamPlot[
{f[x, y], g[x, y]},
{x, -1, 2},
{y, -1, 2}]

deltat = 0.1;
steps = 100;

eulerValues = RecurrenceTable[{
t == 0, x == 1.5, y == 1,
t[k + 1] == t[k] + deltat,
x[k + 1] == x[k] + deltat*f[x[k], y[k]],
y[k + 1] == y[k] + deltat*g[x[k], y[k]]},
{t, x, y},
{k, 0, steps}];
eulerPlotValues = Table[{
eulerValues[[k, 2]],
eulerValues[[k, 3]]},
{k, 1, steps + 1}];
eulerPlot = ListLinePlot[
eulerPlotValues,
PlotMarkers -> Automatic,
PlotStyle -> Red]

Show[streamPlot, eulerPlot]


## Mathematica for linear algebra

Here is some mathematica code to be used by my linear algebra students. The post will be periodically updated as the course progresses.

### Entering matrices

Mathematica views matrices as lists of columns. Thus to enter the matrix $\left( \begin{array}{cccc} 1 & 1 & -1 & -1 \\ 1 & 2 & 3 & 4 \\ 1 & 3 & 5 & 7 \\ \end{array} \right)$
we type in

mat = {{1, 1, -1, -1}, {1, 2, 3, 4}, {1, 3, 5, 7}};


and hit [enter]. Here we have given the matrix the name mat and suppressed the output.

To view the matrix, type in the code

MatrixForm[mat]


and hit [enter].

### Row reducing a matrix

To row reduce the matrix, type in the code

RowReduce[mat]


and hit [enter]. Notice that the output is just given in list format. To display the result as a matrix, you can use either

MatrixForm[RowReduce[mat]]


or

RowReduce[mat] // MatrixForm


## Idea for building intuition for Fourier series and transform

One of the (many) challenging aspects of my Math 305 course (which is roughly a math methods course for scientists) is to help students build intuition for the Fourier transform. Roughly speaking, my goal is for students to not only know how to use Fourier transforms to address problems, but also to gain some intuition for the interplay between “physical space” and “transform space” (also called “k-space” in some physics circles).

(In some sense, what I’m trying to do is to communicate the ideas underlying microlocal analysis without buiding up any of the machinery. Now that I’ve written that, it occurs to me that it could be useful to check out a couple of introductory microlocal analysis books…)

At a first pass, one can look at what it means to be “concentrated” in one space or another. By playing around with functions of the form $e^{-\alpha x^2}$ or characteristic functions, one can pretty quickly develop intuition for the idea that begin “concentrated” in one space roughly corresponds to being “spread out” in another.

Today it occurs to me that it might be very helpful to introduce this same idea when studying cosine/sine Fourier series. A really good exercise would be to plot the magnitude of the coefficients (as a function of frequency) for various functions… and then have students construct functions with various types of frequency distributions. For example, what does a function having equal amounts of the first five frequencies, and no others, look like on physical space? What happens if we toss in equal amounts of frequencies 25-30? Etc.

If this is done at the leve of the Fourier series (and perhaps again at the level of other Fourier-type series, such as Hermite, Legendre, Bessel), then perhaps it will be more natural when we come to Fourier transforms. One can even assign essentially the same problem: Build a function with compact support $[0,1]$ in frequency space. What does it look like in physical space? What happens if we add a function with frequency support in $[25,30]$? Etc.

## Oberwolfach report: Weakly asymptotically hyperbolic metrics and the constraint equations

Earlier this month I gave a lecture at Mathematisches Forschungsinstitut Oberwolfach as part of participating in the workshop “Mathematical Aspects of General Relativity.”

My Oberwolfach Report contains a short description of the contents of my lecture.

## New papers: Weakly asymptotically hyperbolic manifolds, constraint equations, etc.

Two new papers, joint with James Isenberg, John M. Lee, and Iva Stavrov Allen have been posted to the arXiv.

Abstract:

We introduce a class of “weakly asymptotically hyperbolic” geometries whose sectional curvatures tend to $-1$ and are $C^0$, but are not necessarily $C^1$ conformally compact. We subsequently investigate the rate at which curvature invariants decay at infinity, identifying a conformally invariant tensor which serves as an obstruction to “higher order decay” of the Riemann curvature operator. Finally, we establish Fredholm results for geometric elliptic operators, extending the work of Rafe Mazzeo and John M. Lee to this setting. As an application, we show that any weakly asymptotically hyperbolic metric is conformally related to a weakly asymptotically hyperbolic metric of constant negative curvature.

The shear-free condition and constant-mean-curvature hyperboloidal initial data.

Abstract:

We consider the Einstein-Maxwell-fluid constraint equations, and make use of the conformal method to construct and parametrize constant-mean-curvature hyperboloidal initial data sets that satisfy the shear-free condition. This condition is known to be necessary in order that a spacetime development admit a regular conformal boundary at future null infinity. We work with initial data sets in a variety of regularity classes, primarily considering those data sets whose geometries are weakly asymptotically hyperbolic, as defined in [arXiv:1506.03399]. These metrics are $C^{1,1}$ conformally compact, but not necessarily $C^2$ conformally compact. In order to ensure that the data sets we construct are indeed shear-free, we make use of the conformally covariant traceless Hessian introduced in [arXiv:1506.03399]. We furthermore construct a class of initial data sets with weakly asymptotically hyerbolic metrics that may be only $C^{0,1}$ conformally compact; these data sets are insufficiently regular to make sense of the shear-free condition.

A third paper, joint with Iva Stavrov Allen, has also been posted.

Smoothly compactifiable shear-free hyperboloidal data is dense in the physical topology.

We show that any polyhomogeneous asymptotically hyperbolic constant-mean-curvature solution to the vacuum Einstein constraint equations can be approximated, arbitrarily closely in Hölder norms determined by the physical metric, by shear-free smoothly conformally compact vacuum initial data.

## Writing and math

I’m collecting links (in no particular order) to resources for students concerning writing math.

I’ll add to this list when I find more…

## Math 235, Spring 2015: Comments on Report 2

After grading (most of) the second round of reports, I have the following comments:

• While it is necessary to state the methods being used to analyze a system (such as linearizing about an equilibrium), it is not necessary to explain the theory behind the method, or to show all the details. Rather, it is better to tell the reader what method is being used and then to report the result. If the method is long or complicated, you might show the result of an intermediate step.

For example, if you linearize about an equilibrium and find that it is a saddle point, you might report what the eigenvalues are.
One consequence is that most of the math work you do won’t actually get typed up.

• In general, the reports needed to include more interpretation and less computational details.
• Further, it is important to remember that it is the model that is being interpreted. In this case, the model is an “idealized predator-prey model.” While the introduction can motivate such a model by mentioning specific predatory-prey situations, you are not analyzing a specific situation. Rather, you are analyzing the model. This has two important consequences:
• The mechanisms which cause/explain behavior are mathematical, not biological. That is, the reason variable $x$ tends to zero is not because some species isn’t getting enough food, but because the differential equation governing $x$ is pushing the value down.
• If a mathematical statement is made (such as $x$ decreases to zero) this needs to be justified mathematically. A biological interpretation or rationale is neither sufficient nor appropriate.
• It is important to make good choices of windows / ranges when making plots!
• Do not make value judgements. Statements like “this value of $\alpha$ is too large” should be avoided. What is more appropriate is something like “if $\alpha$ is large, then $x$ tends to zero very quickly.”

## Quick tips for using Manipulate in Mathematica

We’ve been using the Manipulate function in class a lot. Here are a couple of quick tips and examples.

The basic idea is to take something you Mathematica to do and add a parameter. For example, suppose you want to plot $\cos{(\omega t)}$ for various values of $\omega$. The first thing I would do is plot the function with some sample value, such as $\omega = 2$.

Plot[Cos[2*t], {t, 0, 2 Pi}]


Next we wrap the whole thing in a Manipulate function, with some parameter w.

Manipulate[Plot[Cos[2*t], {t, 0, 2 Pi}], {w, 2, 4}]


Notice that nothing happens, because we haven’t made anything dependent on w.

Now we replace the 2*t with w*t:

Manipulate[Plot[Cos[w*t], {t, 0, 2 Pi}], {w, 2, 4}]


Notice that Mathematica often does a lot of automatic formatting, which can lead to deceiving results. Here is a poorly designed Manipulation:

Manipulate[Plot[w*Cos[w*t], {t, 0, 2 Pi}], {w, 2, 4}]


Here is a better version of that same Manipulation. (Why is it better?)

Manipulate[Plot[w*Cos[w*t], {t, 0, 2 Pi}, PlotRange -> 5], {w, 2, 4}]


Here is another poorly designed example:

Manipulate[Plot[Cos[2 t] Cos[(2 - a) t], {t, 0, 10 Pi}], {a, 0, .5}]


What should you do to make it better?

Finally, here is another fun example:

Manipulate[
StreamPlot[{x - x^2 - a*x*y, -y + a*x*y}, {x, -.5, 1.5}, {y, -.5,
1}], {a, 0, 4}]


## Math 235, Spring 2015: Comments on Report 1

Here are some comments on Report 1:

• In general, it is better to state the assumptions leading to a model right away, even before giving the equation for the model.
• The general formula for Euler’s method needs to be stated.
• There seemed to be a lot of confusion about who the target audience is. Write as if writing to another faculty member in our department. Thus you can expect that the audience has reasonable math skills, but may not know the specifics of what’s happening in this course. This means that you need to describe technical terms that are specific to this course, but you don’t need to show details of an algebraic computation.
• Clear communication is always a goal for technical writing. You don’t need to add lots of fluffy words where simple ones will do, but you do need to include enough words to communicate the ideas at hand. You should strive to strike a balance between words and symbols.
• The purpose of an abstract, if you include one, is to communicate what the content of the paper is.
• Captions should include a substantial amount of detail. If someone flipped open your paper and looked only at a picture, they should get a good idea of what’s happening just from reading the caption of the figure.

• All math must be between dollar signs, or in a displayed equation. Thus if you have a sentence which references a variable name, that letter should be between dollar signs.
• In you want large parentheses, use the commands \left( and \right).

For example: $\displaystyle \left( 1-\frac{P}{K}\right)$
is written with the command \left( 1-\frac{P}{K}\right)`

• Do give your graphics files names which have spaces in them. This will make LaTex do weird things.

The population $P$ is increasing so long as it is less than $7$.
Notice that I added the words “The population” in front of the $P$, and that I did not put commas around the letter $P$.