[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gsl] Contribution: Hermite polynomials, functions etc.
From: |
Konrad |
Subject: |
Re: [Bug-gsl] Contribution: Hermite polynomials, functions etc. |
Date: |
Sun, 06 Apr 2014 22:58:03 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
Hi Patrick,
absolutely, that would also be possible, there's no efficiency reason.
Only in some special cases the formulas have been simplified a bit.
One problem might be over-/underflow, but that should be very rare: say
you need the physicist flavor but have implemented the probabilist case.
For very small values of the probabilist flavor, the result may already
be rounded to zero, although the corresponding physicist value would be
computable (due to the factor 2^(n/2) between them). Similarly with
reversed roles for overflow.
If one were to code it the way you suggested, I'd fully implement the
probabilist flavor since overflow seems more likely than underflow to
me, but that of course depends on the application you have in mind.
Additionally, the iteration is slightly faster in the probabilist case.
Hope this helps!
Cheers,
Konrad
Am 06.04.2014 20:16, schrieb Patrick Alken:
> Hi Konrad,
>
> Just curious, since there is a simple relationship between the 2
> flavors (probablist and physicist) (ie: Eqs 3 and 4 of your
> specfunc-hermite.texi), why not code up just 1 of them and then for the
> other flavor just use eqs 3-4?
>
> I'm guessing the algorithm for computing both is the same, but using
> different starting values for the recurrence? I'm asking whether there
> is an efficiency reason to have a full implementation of both methods?
>
> Patrick
>
> On 04/06/2014 07:45 PM, Konrad wrote:
>> Hi Rhys and all,
>>
>> 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.
>>
>>
>>
>> Am 11.03.2014 21:29, schrieb Rhys Ulerich:
>>> Hi Konrad,
>>>
>>> Just pinging you to let you know I've not lost track of getting these
>>> into the GSL. I'm about three months past due on my thesis, and so
>>> this has been back-burnered. I still plan to take care of it once
>>> I'm able.
>>>
>>> - Rhys
>>>
>>> On Mon, Dec 9, 2013 at 3:17 PM, Konrad <address@hidden> wrote:
>>>> Hi Rhys and all,
>>>>
>>>> finally I got around to finishing up on the issues with my contribution.
>>>> So please find attached the documentation (specfunc-hermite.texi),
>>>> header file (gsl_sf_hermite.h), precision tests (test_hermite.c) and of
>>>> course the main code (gsl_sf_hermite.c).
>>>> As in my last message on the documentation I should mention the
>>>> following points.
>>>> The introduction is a little longer than in most other chapters, this is
>>>> on purpose since I figured that it is easier for one of you to throw
>>>> parts of it out than to extend it. So feel free to shorten it, the only
>>>> piece of information I find noteworthy is the fact that the Hermite
>>>> functions are eigenfunctions of the Fourier transform. This makes them
>>>> very useful and is often forgotten.
>>>> Since I'm not very well versed in Texinfo, I couldn't get the greek
>>>> character psi on the index, so if somebody knows how to fix this, please
>>>> do, the corresponding line is commented right now.
>>>> Also, the attached file can be compiled on its own, but I've added
>>>> comments where the part relevant for the GSL-manual begins and ends.
>>>> The other files are hopefully sufficiently similar to the GSL-standards.
>>>> Especially, the functions now include rough estimates of the numerical
>>>> errors. Also, some overflow control is implemented throughout the code
>>>> that could be exploited further in the future if necessary.
>>>> Hope this helps, please feel to contact me with any issues that may arise!
>>>>
>>>> Cheers,
>>>> Konrad
>>>>
>>>>
>>>>
>>>>>
>>>>>> 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.
>>>>>
>>>>> Thank you! From a quick pass there are a couple of little things:
>>>>>
>>>>> 1) We need a set of gsl_sf_hermite.h declarations. Should this just
>>>>> be all non-static functions declared within your gsl_hermite.c file?
>>>>> Should the single-point functions like gsl_sf_hermite_prob and
>>>>> gsl_sf_hermite_prob_der be publicly exposed too?
>>>>>
>>>>> 2) We need to get the test cases in gsl_hermite_test.c using the GSL
>>>>> test infrastructure. You can see an example of this within
>>>>> specfunc/test_airy.c. I think getting the test code ported over
>>>>> should be relatively quick but I'm uncertain what tolerances to use
>>>>> given the printf statements in your gsl_hermite_test.c code.
>>>>>
>>>>> 3) We'll need to add documentation for the new functions. These will
>>>>> resemble content like doc/specfunc-airy.texi. Much of the necessary
>>>>> content appears in your email and can be written once we've got a
>>>>> gsl_sf_hermite.h in hand from item 1.
>>>>>
>>>>> These three things don't have to happen all in one commit, but we
>>>>> should get them in place before the next release. I must admit I
>>>>> don't know when that is planned.
>>>>>
>>>>> The code looks very nice from a quick browse. Thank you again.
>>>>>
>>>>> - Rhys
>>>>>
>>>>
>>
>