1
$\begingroup$

Can I do an integral, possibly using gaussian quadrature, when the abscissas are fixed (for reasons that I don't want to get into right now), i.e. is it possible to calculate the weights for fixed abscissas that I don't get to choose?

$\endgroup$
3
  • $\begingroup$ Please see mathoverflow.net/howtoask - I'm not sure what to make of this question. $\endgroup$
    – David Roberts
    Aug 4, 2011 at 23:31
  • $\begingroup$ Sorry if the question is not clear enough. Gaussian quadrature uses a set of polynomials, whose roots become the abscissas and then has a prescription for finding the weight for each abscissa. In my case I do not know the polynomials, only the abscissas beforehand, and would like to find the weights. Thanks. $\endgroup$
    – jackj
    Aug 4, 2011 at 23:38
  • $\begingroup$ Question has also been posted to m.se, math.stackexchange.com/questions/55687/… $\endgroup$ Aug 5, 2011 at 1:11

3 Answers 3

1
$\begingroup$

My interpretation of the problem: given $n$ pairs $(x_j, f(x_j)$ with $a \le x_1 < x_2 < \ldots < x_n \le b$, you want an approximation to $\int_a^b f(x)\, dx$.

One way, that would give the correct value for polynomials of degree $\le n-1$, would be to use $\int_a^b g(x)\, dx$ where $g$ is the Lagrange interpolating polynomial of degree $\le n-1$ corresponding to your data. However, that can be very unstable (see "Runge's phenonenon"). A better idea might be to use something like a composite quadrature rule: partition your interval into subintervals, each containing a few of the $x_j$, and use the interpolation for those $x_j$ in the subinterval to approximate the integral over that subinterval.

$\endgroup$
4
  • $\begingroup$ @Robert Israel: the problem I was trying to solve is precisely as you stated it. Thanks for the answer. So, essentially, many small-power polynomials are better than one large-power polynomial. What I plan to do is use the algorithm J.M. mentioned in each subinterval. $\endgroup$
    – jackj
    Aug 5, 2011 at 18:19
  • $\begingroup$ @jackj: Right, so probably we could give better suggestions if you'd mention what those "fixed abscissas" look like... $\endgroup$ Aug 7, 2011 at 9:28
  • $\begingroup$ @J. M. : sorry for the long delay in responding. My abscissas look like $\delta\sqrt{a+n^2}$ where $a$ is "small" and $n$ is an integer. $\endgroup$
    – jackj
    Aug 11, 2011 at 20:09
  • $\begingroup$ You might map these to uniformly spaced abscissas by the transformation $t = \sqrt{x^2/\delta^2 - a}$. $\endgroup$ Aug 12, 2011 at 1:29
1
$\begingroup$

You could fit a cubic spline through the given data points, and then integrate the cubics exactly.

$\endgroup$
1
$\begingroup$

I have settled this question here; in brief, a FORTRAN implementation of algorithms for solving this problem have been published in the Collected Algorithms of the ACM.


At the risk of being redundant, I'd like to mention here some other things I mentioned in the (now expanded) answer of mine at that other site for completeness' sake.

Robert's warning of the Runge phenomenon happening is a good one, and it does happen if your abscissas are perversely distributed (relatedly, the underlying Vandermonde matrix is ill-conditioned); the equispaced case being among the worst-behaved point distributions. Abscissas that are "nicely distributed" (e.g. Legendre, Chebyshev, or any other point distribution which "clusters" near the ends) will generally ensure that you have a quadrature rule that behaves tamely even for large numbers of points. (As an aside, the chebfun project hinges on functions being nicely approximated by interpolating polynomials with abscissas that are transformed Chebyshev polynomial roots/extrema.)

Lastly, whatever you finally settle with, you will want to perform the sanity check of ensuring that all the weights of your quadrature rule are of the same sign; any change of sign in the weights can lead to subtractive cancellation when you employ the quadrature rule, and you wouldn't want that...

$\endgroup$
2
  • $\begingroup$ This is without doubt the mathematically correct solution, but, as Robert Israel points out in another answer, it could be the solution to the wrong problem: interpolatory quadrature with badly-chosen nodes can give poor results. $\endgroup$ Aug 5, 2011 at 9:02
  • $\begingroup$ @Federico: OK, but I see no reason why I cannot combine J.M.'s solution with Robert Israel's point. Given this fact, I am accepting J.M's answer in the other thread, where he provides details, and Robert Israel's answer in this thread, where he provides the warning. $\endgroup$
    – jackj
    Aug 5, 2011 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.