Skip to content
DeepForgeby svx
All problems
EasyCalculusca-104

Hermite Polynomial Value

Problem

Evaluate the physicists' Hermite polynomial H_n(x) with the recurrence:

H_0 = 1, H_1 = 2x, H_{k+1} = 2 * x * H_k - 2 * k * H_{k-1}

Assume n >= 0.

Hint

The recurrence coefficient 2k distinguishes this convention from the probabilists' version.

Test cases

case 1
in: [0,3]
expected: 1
case 2
in: [1,3]
expected: 6
case 3
in: [2,0.5]
expected: -1
case 4
in: [3,1]
expected: -4
case 5
in: [4,0.5]
expected: 1
Starter codePython
def hermite_h(n, x):
    # Your code here
    pass

5 test cases · run your code against them in the editor