This post will explain the notation used to denote partial derivatives in the output from Sage. It’s confusing at first, but a simple example will make it clear. Here is the input to Sage:

var('x y') function('test', x, y) show(test(x, y)) show(diff(test(x, y), x)) show(diff(test(x, y), x, 2)) show(diff(test(x, y), y)) show(diff(test(x, y), y, 2)) |

I defined a function of two variables called **test**. When you run this in the notebook interface, you get:

test(x,y) D[0](test)(x,y) D[0,0](test)(x,y) D[1](test)(x,y) D[1,1](test)(x,y)

The capital D denotes a derivative. The numbers in brackets indicate which variable the derivative is with respect to. In this example, 0 denotes x and 1 denotes y. The number of times a number is repeated indicates the order of the derivative. **D[0]** is the first derivative with respect to x, **D[1]** is the first derivative with respect to y, **D[0,0]** is the second derivative with respect to x and **D[1,1]** is the second derivative with respect to y. Sage uses the same notation when typesetting equations in LaTeX, so you will have to do some manual typsetting if you want traditional partial derivative notation.

Why does Sage do it this way instead of using traditional notation? The reason is that **test** is defined as a function of two variables, but Sage doesn’t know in advance what these variables will be. **test** may be a function of two other functions, in which the chain rule would have to be used to display the derivatives correctly. The extensive discussion that went into this design decision is archived in this thread.

If you’re new to Sage, I suggest you check out my Sage Beginner’s Guide.