An archive the questions from Mark's Fall 2018 Complex Variables Course.

How do I input computer code?

admin

When writing mathematics, we often want to refer to some computational code that we used, perhaps written with Mathematica, Sage, Python, R, or some other language. When doing so, it’s nice if the code that we present looks like computer code. For example, it should be a fixed-width or monospaced font and should appear as a contiguous block. Also, any output should be clearly presented as well. For example, here’s some sage code that we might use to solve x^3-2x+1=0 for x:

solve(x^3 - 2*x + 1 == 0, x)
# Out: [x == -1/2*sqrt(5) - 1/2, x == 1/2*sqrt(5) - 1/2, x == 1]

To create that block block, all I did was indent the code indent my input four spaces. Try it!!!

Sometimes, we might want a single computer command inline. For example, we might point out that the previous input was an application of the solve command. To include that monospaced font inline, we just enclose the code with backticks. Thus:

Here's a sentence with the `solve` command.