bugGNU Scientific Library - Bugs: bug #43260, Hermite polynomial contribution

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #43260: Hermite polynomial contribution

Submitter:  Patrick Alken <psa>
Submitted:  Fri 19 Sep 2014 04:22:17 PM UTC
   
 
Category:  None Severity:  3 - Normal
Operating System:  Status:  Fixed
Assigned to:  None Open/Closed:  Closed
Release: 

Sun 05 Mar 2017 02:24:57 PM UTC, comment #2: 

Hermite polynomial code is now in master branch on git

Patrick Alken <psa>
Group administrator
Fri 12 Dec 2014 07:26:39 PM UTC, comment #1: 

Updated files available at:

http://lists.gnu.org/archive/html/bug-gsl/2014-04/msg00004.html

since finishing the Hermite polynomials and functions, I got around to
including their zeros. Building on that, I also wrote two small
Gauss-Hermite quadrature routines, which similarly to the existing
Gauss-Legendre routines do not accept errors bounds.
Please find attached the code (gsl_sf_hermite.c,
gsl_integration_hermite.c), header (gsl_sf_hermite.h,
gsl_integration_hermite.h), test (test_hermite.c, test_hermite_quad.c)
and documentation (specfunc-hermite.texi, integration-hermite.texi) files.
In gsl_integration_hermite.c, the correct header file has to be called
once the other routines are included in the GSL.

Cheers,
Konrad

P.S.: As always, please notify me if any bugs are found etc.

Patrick Alken <psa>
Group administrator
Fri 19 Sep 2014 04:22:17 PM UTC, original submission:  

From konradg =at= gmx =dot= net

Dear GSL-Team,

a while back I asked how to submit some of my work and was told to
send it to this address. So here it goes!
There's a piece of code I'd like to contribute to your great library.
It consists of a few functions to compute Hermite polynomials, Hermite
functions and their respective derivatives, please see the attachment
gsl_hermite.c. I have tried to name them in such a way that they can
directly be used in the GSL, but since I'm not sure about any policies
please feel free to make any changes you deem neccessary.
Here's an overview:

- - gsl_sf_hermite_prob(const int n, const double x): Evaluates the
probabilists' Hermite polynomial of order n at position x.
- - gsl_sf_hermite_prob_der(int m, int n, double x): Evaluates the m-th
derivative of the probabilists' Hermite polynomial of order n at
position x.
- - gsl_sf_hermite_phys(const int n, const double x): Evaluates the
physicists' Hermite polynomial of order n at position x.
- - gsl_sf_hermite_phys_der(int m, int n, double x): Evaluates the m-th
derivative of the physicists' Hermite polynomial of order n at position x.
- - gsl_sf_hermite_func(const int n, const double x): Evaluates the
Hermite function of order n at position x.
- - gsl_sf_hermite_prob_series(const int n, const double x, const double

  • a): Evaluates the series sum_{j=0}^n a_j*He_j(x) with He_j being the

j-th probabilists' Hermite polynomial.
- - gsl_sf_hermite_prob_array(const int nmax, const double x, double *
result_array): Evaluates all probabilists' Hermite polynomials up to
order nmax at position x. The results are stored in result_array.
- - gsl_sf_hermite_prob_array_der(const int m, const int nmax, const
double x, double * result_array): Evaluates the m-th derivative of all
probabilists' Hermite polynomials up to order nmax at position x. The
results are stored in result_array.
- - gsl_sf_hermite_prob_der_array(const int mmax, const int n, const
double x, double * result_array): Evaluates all derivatives (starting
from 0) up to the mmax-th derivative of the probabilists' Hermite
polynomial of order n at position x. The results are stored in
result_array.
- - gsl_sf_hermite_prob_series(const int n, const double x, const double

  • a): Evaluates the series sum_{j=0}^n a_j*He_j(x) with He_j being the

j-th probabilists' Hermite polynomial.
- - gsl_sf_hermite_phys_array(const int nmax, const double x, double *
result_array): Evaluates all physicists' Hermite polynomials up to
order nmax at position x. The results are stored in result_array.
- - gsl_sf_hermite_phys_array_der(const int m, const int nmax, const
double x, double * result_array): Evaluates the m-th derivative of all
physicists' Hermite polynomials up to order nmax at position x. The
results are stored in result_array.
- - gsl_sf_hermite_phys_der_array(const int mmax, const int n, const
double x, double * result_array): Evaluates all derivatives (starting
from 0) up to the mmax-th derivative of the physicists' Hermite
polynomial of order n at position x. The results are stored in
result_array.
- - gsl_sf_hermite_phys_series(const int n, const double x, const double

  • a): Evaluates the series sum_{j=0}^n a_j*H_j(x) with H_j being the

j-th physicists' Hermite polynomial.
- - gsl_sf_hermite_func_array(const int nmax, const double x, double *
result_array): Evaluates all Hermite functions up to order nmax at
position x. The results are stored in result_array.
- - gsl_sf_hermite_func_series(const int n, const double x, const double

  • a): Evaluates the series sum_{j=0}^n a_j*Psi_j(x) with Psi_j being

the j-th Hermite function.
- - gsl_sf_hermite_func_der(const int m, const int n, const double x):
Evaluates the m-th derivative of the Hermite function of order n at
position x.

As you can see, the routines for the polynomials exist in the
probabilists' and the physicists' versions. If a default has to be
chosen, I'd suggest the probabilists' routines due to their smaller
susceptibility to overflow.
The naming of the routines may be an issue especially with
gsl_sf_hermite_prob_array_der vs. gsl_sf_hermite_prob_der_array (and
their physicists' equivalents), I'm not sure this is a very clear
choice, but I kept it for lack of a better idea.
Please find a very simple test of the routines in the second
attachment (gsl_hermite_test.c). A more thorough check would make sense.
Also included in the code is a small ToDo-list for additional
functionality. Unfortunately I probably won't be able to put a lot of
work into this at the moment. (I've had this code laying around for
quite a while already and only now got around to preparing it for the
GSL...)

There is only one issue that requires your attention: as I don't know
if there are any rules as to when an asymptotic approximation is to be
used instead of the (slower) standard calculation, I have set the
limit to the order 10000 (orders above that often result in overflow),
please adjust this value.

If there's anything that needs to be done before the functions can be
included in the next release (like writing documentation), please let
me know how I can help. In that case it would be good to know what the
deadline for the upcoming release is.

On a completely unrelated topic: the last digit in the first zero of
the Airy function Ai is wrong in the GSL-function: it reads
- -2.338107410459767039 instead of
- -2.338107410459767038, which is correct.

Last but not least: thanks you all for your time and effort, you've
helped many people a great deal!

Cheers,
Konrad

Patrick Alken <psa>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #32135:  gsl_hermite.c added by psa (25KiB - text/x-c)
file #32136:  gsl_hermite_test.c added by psa (26KiB - text/x-c)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psa (Submitted the item)
  •  

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-05-24 psa StatusNone Fixed
        Open/ClosedOpen Closed
    2014-09-19 psa Attached File- Added gsl_hermite.c, #32135
        Attached File- Added gsl_hermite_test.c, #32136

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code