How to choose N for Gaussian Quadrature

Click For Summary
SUMMARY

The discussion focuses on evaluating the definite integral of the function \( \sqrt{1-x^2} \) from -1 to 1 using Gauss-Legendre quadrature. Participants clarify that Gauss quadrature provides exact results for polynomials of degree \( 2N-1 \) or less, emphasizing that the choice of \( N \) influences the number of function evaluations and the accuracy of the approximation for non-polynomial functions. The conversation highlights the importance of understanding polynomial degrees and the behavior of the function at the limits, concluding that both \( N=1 \) and \( N=2 \) yield correct results for this specific integral.

PREREQUISITES
  • Understanding of Gauss-Legendre quadrature
  • Knowledge of polynomial degrees and roots
  • Familiarity with numerical integration methods
  • Basic proficiency in using Mathematica for plotting functions
NEXT STEPS
  • Learn about the properties of Gauss-Legendre quadrature
  • Explore the implications of polynomial degree on numerical integration
  • Investigate other numerical methods for integration, such as Simpson's Rule
  • Practice implementing numerical integration techniques in Mathematica
USEFUL FOR

Students and professionals in mathematics, physics, and engineering who are interested in numerical methods for integration, particularly those using Gauss-Legendre quadrature for evaluating definite integrals.

ognik
Messages
626
Reaction score
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
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:
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?
 
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   Reactions: ognik
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 exercise 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.
 
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   Reactions: ognik
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.
 

Similar threads

Replies
2
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
Replies
4
Views
2K
Replies
2
Views
2K
  • · Replies 18 ·
Replies
18
Views
3K
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K