I'm trying to make a generalized quadrature method and I seem to be running into some bizarre errors. For n=2 my answer is twice what it should be and for n greater the innaccuracy increases (answer/n is close but worse than answer/2 with n=2). My general algorithm is:(adsbygoogle = window.adsbygoogle || []).push({});

p = nth legendre polynomial

[itex]g = x \rightarrow f\left(\frac{b-a}{2}x+\frac{b+a}{2}\right)[/itex] where f is the function to integrate

xs = n roots of p

ws = weights based on value of n (2 => +/-0.57735026918963)

[itex]\frac{b-a}{2}\sum^n_0{w_ig(x_i)}[/itex]

I've checked my generation of legendre functions and they're consistently correct. I also generated a list of roots and verified some against wikipedia's list. Have I stupidly mangled the actual gaussian quadrature algorithm?

I'm writing this in haskell so my code is 1:1 with the pseduo-code above.

Thanks ahead for the help.

Sorry if this is in the wrong forum, it's not coursework, but it is academic.

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Gaussian Quadrature Question

Loading...

Similar Threads - Gaussian Quadrature Question | Date |
---|---|

I Gaussian Quadrature on a Repeated Integral | Nov 28, 2017 |

From Gaussian Quadrature to Chebyshev Quadrature | Aug 14, 2012 |

How to compute Gaussian Quadrature weights? | Dec 24, 2010 |

Numerical Integration: Gaussian Quadrature | Sep 11, 2009 |

Gaussian Quadrature` | Oct 2, 2005 |

**Physics Forums - The Fusion of Science and Community**