I'm working with Magma to do computations with Jacobians of genus 2 hyperelliptic curves, and I find some behavior for elements that I don't understand. Specifically, let us take the prime $p = 431$ and the finite field $\mathbb{F}_p$, and the curve $$C : y^2 = x^6 + 305x^5 + 64x^4 + 430x^3 + 367x^2 + 305x + 430.$$
Then let $J = \operatorname{Jac}(C)$, by random sampling, I can find the following element $$D = (x + 279, 430x^3 + 345) \in J.$$ This should be a Mumford representation, e.g. reduced so that the degree of the second coordinate is lower than the degree of the first. So why does Magma give me this strange element to work with?
Furthermore, if I try to coerce it back into J, it tells me it fails! See also the following script for the Magma calculator
p := 431;
F := GF(p);
poly<x> := PolynomialRing(F);
C := HyperellipticCurve(x^6 + 305*x^5 + 64*x^4 + 430*x^3 + 367*x^2 + 305*x + 430);
J := Jacobian(C);
repeat D := Random(J); until Degree(D[2]) gt 2;
D;
J![D[1], D[2]]; \\fails!
Sabrina Kunzweiler was able to explain to me in a bit more detail what was going on. With her permission, I'm copying that here.
In Magma, elements of the Jacobian of a genus-2 curve are represented as $[D - D_\infty]$ where $D_\infty = \infty_+ + \infty_-$ and $D$ is a degree-2 divisor defined by the Mumford representation.
In the generic case, $D = P_1 + P_2$ for two affine points on the hyperelliptic curve $C$, but one also needs to consider the cases $D = P + \infty_\pm$. This is where the degree-3 polynomials appear in the Mumford representation $(u, v, d)$. For an element in this form, you can find the support by computing the points on the curve satisfying both $U(X, Z) = 0$ and $Y = V(X, Z)$ where $U, V$ are homogenizations of $u, v$ of degree $d$ and $g + 1$ respectively.
In the example given in the question, $D = (x + 279, 430 x^3 + 345, 2)$ and so the support is $P = (152 : 325 : 1)$ and the second point $\infty_- = (1 : -1 : 0)$. Hence, on the Jacobian, the element is $[P - \infty_-]$ and you can check this in Magma by:
One can coerce these elements in Magma! However, it is necessary to define $d$ in $(u,v,d)$, otherwise Magma sets $d = \deg u$ by default. In the example given, $\deg u = 1$ is not a valid value for $d$, but the following works.