bugGNU Scientific Library - Bugs: bug #32233, Gauss-Legendre routine does not...

 
 

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

bug #32233: Gauss-Legendre routine does not work in gsl-1.14

Submitter:  Susi Lehtola <jussilehtola>
Submitted:  Mon 24 Jan 2011 03:06:59 PM UTC
   
 
Category:  None Severity:  3 - Normal
Operating System:  Status:  Invalid
Assigned to:  rhysu Open/Closed:  Closed
Release: 

Mon 24 Jan 2011 04:25:01 PM UTC, comment #3: 

Closing.  Glad to see someone's using that new 1.14 functionality!

- Rhys

Rhys Ulerich <rhysu>
Group administrator
Mon 24 Jan 2011 03:52:59 PM UTC, comment #2: 

Oh, okay. Thanks for the clarification, I see now that you do use the symmetricity consistently, and functions are indeed integrated correctly. So you can close this bug.

A function to get the nodes and weights would be very useful, indeed, so I'll make an RFE.

Susi Lehtola <jussilehtola>
Mon 24 Jan 2011 03:32:39 PM UTC, comment #1: 

Good morning Jussi,

Three comments:

1) You've filed a bug report on an internal implementation detail-- you'll note that the GSL manual says nothing definite about the contents of gsl_integration_glfixed_table.  That was deliberate.

I believe that if you check the code against a 2nd order polynomial it will behave correctly.  The GSL source code contains exactly such a test within integration/test.c near a comment saying "Test the fixed-order Gauss-Legendre rules with a monomial".

2) The weights and points are symmetric about zero leading to only about half of the points needing to be stored.  That 0.57735 value you show is used twice, once at 0.57735 and once at -0.57735 each time with weight 1.  This sums to 2.  The point x = 1 has w = 0, as your table shows, and does not contribute to such a sum.  But again, this is an implementation detail.

3) If you have a need to access the points and weights, please consider filing a feature request.  It should be easy to provide an API call that will return the values that MathWorld lists.

Does this address your concerns about the correctness?  May I close this bug?

- Rhys

Rhys Ulerich <rhysu>
Group administrator
Mon 24 Jan 2011 03:06:59 PM UTC, original submission:  

The Gauss-Legendre routines are not working in gsl-1.14.

According to the documentation, gsl_integration_glfixed_table_alloc should compute the abscissae and weights for the wanted order of integration.

However, at least the weights are clearly wrong. The sum of the weights should always give the length of the integration interval [1], which is not the case with the routine.

For instance, the 2nd order result computed by gsl_integration_glfixed_table_alloc is

Gauss-Legendre abscissae and weights of order 2, sum of weights 1.000000e+00, precomputed? 1
x w
5.773503e-01 1.000000e+00
1.000000e+00 0.000000e+00

so the first point is calculated correctly; the second should be at -5.773503e-01 with a weight also of 1.000000e+00.

[1] http://mathworld.wolfram.com/Legendre-GaussQuadrature.html

Susi Lehtola <jussilehtola>

 

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

Attached Files
file #22503:  legendretest.c added by jussilehtola (1KiB - text/x-csrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rhysu (Posted a comment)
  • -email is unavailable- added by jussilehtola (Submitted the item)
  •  

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-01-24 rhysu StatusNeed Info Invalid
        Open/ClosedOpen Closed
    2011-01-24 rhysu StatusNone Need Info
        Assigned toNone rhysu
    2011-01-24 jussilehtola Attached File- Added legendretest.c, #22503

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code