Other mathematics

Solving equations numerically

In the module

latqcdtools.math.optimize

there is a the method

persistentSolve(LHS, guess, tol=1e-8, maxiter=200)

which will try to solve the equation LHS==0 within tolerance tol, using up to maxiter iterations. This tries a few SciPy methods: in order, newton_krylov, fsolve, then root. This is not necessarily the most optimal order. It stops when one of them succeeds.

Constructing polynomials

The module

latqcdtools.math.polynomials

contains Polynomial and Rational objects that can be used to succinctly represent polynomials or rational functions. For example

p = Polynomial([A0, 0., A2, 0. A4])
p(x)

constructs a polynomial of only even powers up to fourth order.

Special functions

Most special functions are covered by SciPy, but some either somehow return extra values or have notation that David is not used to. Therefore you can find

  • riseFactorial: Compute \((n)^m\).

  • fallFactorial: Compute \((n)_m\).

  • logDet: Compute logarithm of determinant of a matrix.