# openfermion.transforms.weyl_polynomial_quantization

Apply the Weyl quantization to a phase space polynomial.

### Used in the notebooks

Used in the tutorials

The Weyl quantization is performed by applying McCoy's formula directly to a polynomial term of the form q^m p^n:

q^m p^n -> (1/ 2^n) sum_{r=0}^{n} Binomial(n, r) \hat{q}^r \hat{p}^m q^{n-r}

where q and p are phase space variables, and \hat{q} and \hat{p} are quadrature operators.

The input is provided in the form of a string, for example

.. code-block:: python

weyl_polynomial_quantization('q0^2 p0^3 q1^3')


where 'q' or 'p' is the phase space quadrature variable, the integer directly following is the mode it is with respect to, and '^2' is the polynomial power.

polynomial (str): polynomial function of q and p of the form 'qi^m pj^n ...' where i,j are the modes, and m, n the powers.

QuadOperator the Weyl quantization of the phase space function.

#### Warning:

The runtime of this method is exponential in the maximum locality of the original operator.