pythonscipypolynomials

scipy.special.eval_hermite with complex argument


Does the scipy.special eval_hermite function only support real arguments? From the documentation (https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.eval_hermite.html), I assumed complex would work fine and I also don't see any programmatic reason why it should not. However, I get the following error:

scipy.special.eval_hermite(4, 1.j)
# output: TypeError: ufunc 'eval_hermite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Does anyone know why this is? Or how to work around it?


Solution

  • It seems that the following numpy class works for complex-valued inputs: https://numpy.org/doc/stable/reference/generated/numpy.polynomial.hermite.Hermite.html#numpy.polynomial.hermite.Hermite