Ask Your Question

Revision history [back]

Let me summarize the comments:

1) Use symbolic functions, e.g.:

sage: var('y')
sage: f = function('a')(y) + function('b')(y)*i + function('c')(y)*j + function('d')(y)*k
sage: qd(f)
-diff(c(y), y) + diff(d(y), y)*i + diff(a(y), y)*j + (-diff(b(y), y))*k

2) Do the LaTeX yourself (for now), e.g. like this:

def qlatex(u):
    return LatexExpr(' + '.join(r'\bigg[' + latex(u[k]) + r'\bigg]\cdot' + latex(Q.basis()[k]) for k in range(len(Q.basis()))))
show(qlatex(g))

Of course this can be improved (draw parentheses only if necessary, skip zeros, extract signs, etc.)

The documentation of LatexExpr is under LaTeX printing support.

3) Issue #6183 Quaternion algebra latexification has been open for 11 years.

If you want to revive it, you could bring it up (with or without patch) on sage-devel.

The old patch linked in the issue also has the start of a _latex_ method.