How to choose N for Gaussian Quadrature

In summary, the homework statement is that Gauss quadrature yields the exact integral if φ is of degree 2N-1 or less.
  • #1
ognik
643
2

Homework Statement


Evaluate the definite integral below numerically (between limits -1 and 1) using a couple of numerical methods, including Gauss-Legendre quadrature - and compare results.

Homework Equations


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

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:
Physics news on Phys.org
  • #2
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:
  • #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?
 
  • #4
ognik said:
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?

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:
 
  • Like
Likes ognik
  • #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.
 
  • #6
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?
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:
  • Like
Likes ognik
  • #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.
 

Related to How to choose N for Gaussian Quadrature

1. What is Gaussian Quadrature and why is it important in scientific research?

Gaussian Quadrature is a numerical method used to approximate the definite integral of a function. It is important in scientific research because it allows for accurate calculations of integrals that cannot be solved analytically, which are common in many scientific fields.

2. How is N chosen for Gaussian Quadrature?

N, also known as the number of points, is typically chosen based on the degree of precision desired. A higher N will result in a more accurate approximation, but will also require more computations. In general, N is determined by considering the degree of the polynomial that can be exactly integrated and then adding one to that value.

3. What is the relationship between N and the number of integration points in Gaussian Quadrature?

The number of integration points in Gaussian Quadrature is equal to N. This means that if N is equal to 5, there will be 5 integration points used in the calculation.

4. How does the choice of N affect the accuracy of the approximation in Gaussian Quadrature?

The choice of N directly affects the accuracy of the approximation. As mentioned before, a higher N will result in a more accurate approximation, while a lower N will result in a less accurate approximation. It is important to choose an appropriate N based on the desired level of precision.

5. Are there any guidelines for choosing N in Gaussian Quadrature?

There are some general guidelines for choosing N, such as considering the degree of the polynomial and the desired precision, but there is no fixed rule for selecting N. It is often a trial and error process, where the result is checked against known values or compared to other numerical methods.

Similar threads

  • General Math
Replies
12
Views
1K
  • Advanced Physics Homework Help
Replies
4
Views
2K
  • Advanced Physics Homework Help
Replies
2
Views
1K
Replies
18
Views
3K
  • General Math
Replies
4
Views
782
  • Advanced Physics Homework Help
Replies
3
Views
2K
Replies
2
Views
1K
Replies
3
Views
2K
Back
Top