1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: How to choose N for Gaussian Quadrature

  1. Apr 2, 2015 #1
    1. The problem statement, all variables and given/known data
    Evaluate the definite integral below numerically (between limits -1 and 1) using a couple of numerical methods, including Gauss-Legendre quadrature - and compare results.

    2. Relevant equations
    $$ \int{(1-x^2)^\frac{1}{2}} dx $$
    "Gauss quadrature yields the exact integral if φ is of degree 2N-1 or less"

    3. The attempt at a solution
    Its not obvious to me what degree this polynomial is? I would say it has 2 roots, so must be of degree 2?
    I believe, as above, I need the degree to decide what degree to use for Gauss-Legendre quadrature; If this is of degree 2, then can I use N=2 for the quadrature?
    Last edited: Apr 2, 2015
  2. jcsd
  3. Apr 3, 2015 #2


    User Avatar
    Science Advisor
    Homework Helper
    2017 Award

    If you make a drawing you'll see that it definitely isn't degree 2 ...
    And if you like Taylor expansions, you get an infinitely long one for this !
    Last edited: Apr 3, 2015
  4. Apr 3, 2015 #3
    Hi - I had plotted it already using Mathematica (to try and make sense of it before resorting to the forum), and it looks like an upside down parabola between the limits and zero at the limits - but the curve 'bounces/arcs back' above the x axis at those 2 limits, extending indefinitely upward; That is still 2 roots isn't it?

    In the meantime I wrote the program and made it easy to try different values of N - and it gives the same (correct) answer for N=2 AND N=1... so it seems to have aspects of both 1st and 2nd order polynomials - which is what confused me from the start. I've essentially finished the problem, this is a side issue for my own understanding :-)

    Something else I thought of - the curve is not smooth at those limits, so often this might cause singularities... but I think not in this case? I also adapted a simpsons method program I had written - just to compare, and that simply adds 0 for the limits (1st and last values in Simpson) to the sum, which seems OK to me. Just wondering as well - have I got this aspect right?
  5. Apr 4, 2015 #4


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    I think you are over thinking this.

    The caveat was "Gauss quadrature yields the exact integral if φ is of degree 2N-1 or less", which means if you are integrating a polynomial in integer powers, the use of G-Q has the added benefit that the numerical result is exactly the same as evaluating the integral analytically. For integrals of all other functions, the numerical evaluation using G-Q will be an approximation of the value of the integral, although this approximation may have quite high accuracy.

    Picking the order of the G-Q method before doing the calculation is only relevant in that this controls how many function evaluations must be done over the interval and the location of the ordinates. If you check the results of your program, you should be able to see whether the variation in accuracy of result versus the order of the G-Q method is significant or not.

    If you apply your program to integrating a polynomial with integer exponents, the results you get should be the same, regardless of order of the G-Q employed. :wink:
  6. Apr 5, 2015 #5
    Hi - yes by definition I am over-thinking this - because I already finished the problem, but questions like this nag me....thanks muchly for your explanation, which paints a much clearer picture. I suppose that anyway for non-polynomial functions there are a bunch of other indicators for which value of N yields exact results.... This GQ excercise has been mildly mind-blowing, I knew GQ was very accurate, but being exact for a very small number of 'steps' was not something I expected. Go Gauss!
    Don't suppose you'd care to have a look at my other 2 problems on this forum? (https://www.physicsforums.com/threa...merov-integration-method.806295/#post-5062650 and https://www.physicsforums.com/threa...te-systems-scale-factors.806607/#post-5064197) Thanks & regards.
  7. Apr 6, 2015 #6


    User Avatar
    Science Advisor
    Homework Helper
    2017 Award

    If ##\ y = \sqrt {1-x^2} \ ## and ##\ -1 \le x \le 1\ ## then ##\ x^2 + y^2 = 1\ ##.

    Isn't there something this reminds you of ?

    PF frowns on mixing threads. Better keep them separate.

    As to Numerov: You had a clear tip on what to do. Why not do it and post, so you can be helped further ?
    And as to the other one: perhaps some more context ? At least: make sure all variables are explained.
    Last edited: Apr 6, 2015
  8. Apr 6, 2015 #7
    Oops, yes I see the trig substitution now, I must have done something weird with mathematica the first time...I don't think that affects the Gauss quadrature problem in any way though?
    Thanks for input on others and yes to keeping threads separate.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted