Most effective non uniform mesh, composite trapezoidal rule. help pleaseee

In summary, the conversation is about using a composite trapezoidal rule to approximate integrals and finding the most efficient non-uniform mesh to reduce error while keeping the number of intervals the same. The idea is to pack the samples more closely where the second derivative is large and more sparsely where it is small. The conversation also discusses the use of higher order integrators and the application of the composite trapezoidal rule in an assignment. Finally, a specific example is given to illustrate the concept of optimizing the location of sample points to minimize error.
  • #1
aerot89
4
0
Hi guys, I'm using a composite trapezoidal rule to approximate the integral of functions. Up till now I have been using a uniform composite mesh, ie, there are J intervals, each interval being 1/J wide (since the integral is between 0 and 1).

How do I find the most efficient non-uniform mesh that will reduce the error while keeping the number of intervals J the same? eg ((0:J)/J)^x

Any help would be greatly appreciated, I have looked through all my lecture notes, and done some pretty thorough online searching but to no avail.

Thanks
Edit/Delete Message
 
Mathematics news on Phys.org
  • #2
As long as the integrand's properties are completely undefined, uniform is the best you can do.
 
  • #3
Hey, thanks for your response, the integrals we are dealing with are actually well defined though.

I wrote a MATLAB program that would take the uniform mesh over [0,1] and raise it to a power eg
mesh = ((0:J)/J)^x, so that the points were more concentrated at the start or end depending on the choice of x.

it then calculated the value of x that minimised the error in the numerical estimate of the integral.

Is there anyway of proving why this value of x produced the most efficient mesh?

Thanks
 
  • #4
aerot89 said:
Hey, thanks for your response, the integrals we are dealing with are actually well defined though.

I wrote a MATLAB program that would take the uniform mesh over [0,1] and raise it to a power eg
mesh = ((0:J)/J)^x, so that the points were more concentrated at the start or end depending on the choice of x.

it then calculated the value of x that minimised the error in the numerical estimate of the integral.

Is there anyway of proving why this value of x produced the most efficient mesh?

Thanks

In general you would want to pack the samples more closely where the absolute value of the second derivative is large and more sparsely where it (the second derivative) is small.

However wouldn't the effort be better spent in applying a higher order integrator such as Simpsons rule?
 
  • #5
Ah thanks, that's pretty helpful. I guess it makes sense because the rate of change of the gradient is greatest! Yeah but I've got an assignment that is all based around the composite trapezoidal rule and developments on it..

Thanks again.
 
  • #6
Taking the problem to extremes, say you have a curve y=x^2 in the domain [0,1], and you are allowed three samples, one at (0,0), one at (1,1). Where do you put the third to minimise the error?

If your point is at the value a (for 0<a<1), then your estimation of the area is:

trapezium 1 = a*(0 + a^2)/2 = a^3/2
trapezium 2 = (1 - a)(a^2 + 1)/2

so the estimate function is f(a) = [a^3 + (1 - a)(a^2 + 1)]/2
f(a) = (a^2 - a + 1)/2

The error is then the real value minus this estimate, and the real area is 1/3.

err(a) = 1/3 - (a^2 - a + 1)/2

to minimise this we differentiate and set equal to zero,

err'(a) = a - 1/2 = 0
a = 1/2.

ie. an even mesh. (in line with post #4 and your reply since the 2nd derivative of x^2 is constant).

This is my interpretation of your discussion about the composite trapezoidal rule... is it correct? Basically summing all the trapeziums for variable sample points and using the error to optimise the location of the points. Try it with y=x^3 and I would put money on a not being equal to 1/2.
 

1. What is a non-uniform mesh?

A non-uniform mesh is a type of computational grid or mesh that is not evenly spaced. This means that the distance between grid points is not constant and can vary throughout the grid.

2. What is the composite trapezoidal rule?

The composite trapezoidal rule is a numerical integration method used to approximate the value of a definite integral. It involves dividing the interval of integration into smaller subintervals and using the trapezoidal rule to approximate the integral over each subinterval, then summing these approximations together to get an overall approximation of the integral.

3. How does using a non-uniform mesh affect the accuracy of the composite trapezoidal rule?

Using a non-uniform mesh can improve the accuracy of the composite trapezoidal rule in certain cases. This is because it allows for more grid points to be placed in areas where the function being integrated is changing more rapidly, resulting in a better approximation of the integral.

4. What are the advantages of using the composite trapezoidal rule over other numerical integration methods?

The composite trapezoidal rule is relatively easy to implement and does not require as much computational power as other numerical integration methods such as Simpson's rule. It also has a relatively low error compared to other methods, making it a good choice for many integration problems.

5. Can the composite trapezoidal rule be used for higher dimensional integrals?

Yes, the composite trapezoidal rule can be extended to higher dimensional integrals by dividing the integration region into smaller subregions and using the trapezoidal rule to approximate the integral over each subregion. However, as the number of dimensions increases, the accuracy of the method may decrease and other integration methods may be more suitable.

Similar threads

  • Programming and Computer Science
3
Replies
75
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
14
Views
7K
Replies
1
Views
1K
  • Math Guides, Tutorials and Articles
Replies
8
Views
20K
  • Precalculus Mathematics Homework Help
Replies
13
Views
2K
Replies
1
Views
1K
  • General Discussion
Replies
4
Views
662
  • STEM Academic Advising
Replies
4
Views
2K
Replies
4
Views
30K
Back
Top