Haskell allows to represent recurrent functions in a very concise way. For example, infinite list, that contains Fibonacci numbers can be defined as follows:
fibs :: [Integer]
fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
I am dealing with 'probabilists' Hermite polynomials, which have the following recursion relation:
What would be the optimal way to construct the infinite list of n-th Hermite polynomials for given x?

We can write it as:
where the first items
1 : x : ...are the first elements of thehermite(you can fill in other values).For the next one, we zip the original values
s(so that starts withH0), the tailtsofs(that starts withH1) and the index (that starts with2,3, ...) and perform an operationx*hn1 - x*hn2(nh1stands for Hn-1, andnh2stands for Hn-2), and so we calculate the next element each time.The first 11 values for
x = 0.75are:So the first value is 1, the second
x, the third onex*x-2, the fourth onex*x*x-2*x-3*x, and so on.That being said, if I recall correctly, the recursion formula of the Hermite polynomials is:
Hn(x) = 2×x×Hn-1(x)-2×(n-1)Hn-2(x)
instead of the one quoted in the question.
In that case the formula is thus:
Then the first 11 values are:
Which is correct acording to this Wolfram article:
Which maps exactly on the values we obtained: