[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question on the derivative of Hermite function (gsl_sf_hermite_func_der_
From: |
xiaonu xiong |
Subject: |
Question on the derivative of Hermite function (gsl_sf_hermite_func_der_e) |
Date: |
Sat, 7 Oct 2023 19:23:38 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 |
I try to calculate the 1st derivatives of Hermite function using
`gsl_sf_hermite_func_der_e(1, n ,x, result)`, following the documentation
https://www.gnu.org/software/gsl/doc/html/specfunc.html#derivatives-of-hermite-functions
The results seem incorrect for n = 0 and n=1.
For n=0, `result.val` always gives 0 for any x. However, psi_0(x) is
basically a Gaussian function and the 1st derivative of psi_0(x) is
proportional to -x*exp(-x^2/2), which does not vanish for a nonzero x.
Similarly, for n=1 `gsl_sf_hermite_func_der_e` also gives incorrect result.
I dig a little bit in the source code `hermite.c` and I find that from
line 1189 to 1222, in the branch of 1st derivative (m=1) case, the
code uses the relation psi'_n(x) = sqrt(2 n) psi_{n-1} - x psi_n, but
the recursion (line 1198 to line 1214) starts with i=2 and ends with
i<=n, which has exclude n=0 and n=1 cases and the initial values of some
intermediate variables make psi'_0(x) to be zero.
For n >=2, the results are as expected.
I am wondering is this behavior intended? My GSL version is 2.7.
Bests,
Xiaonu Xiong
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Question on the derivative of Hermite function (gsl_sf_hermite_func_der_e),
xiaonu xiong <=