Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How can we use adaptive quadrature to approximate the following integral to $10^{-5}$?

$$\int_0^{\pi/2}(6\cos4x+4\sin6x)e^x\,dx$$

Thanks

share|improve this question
    
Do you want an algorithm, or want someone to point you to a software package that you can use to actually compute it? In the event of the latter, what's your favorite language? I can suggest solutions in C/C++, Matlab, and Python. –  Jerry Gagelman Mar 4 '12 at 14:08
    
can you do this by hand, or use Matlab program? Thanks –  James R. Mar 4 '12 at 19:06
    
Or the free alternative, GNU Octave: gnu.org/software/octave –  dls Mar 4 '12 at 19:40
1  
Have you read the wikipedia page? Adaptive quadrature is very boring to do by hand. The Adaptive Simpson's method is easy to implement. –  lhf Apr 3 '12 at 20:00
add comment

2 Answers 2

If you have access to Matlab, just use the quadl function: http://www.mathworks.com/help/techdoc/ref/quad.html

share|improve this answer
    
can you put modify the matlab code for the function of interest in this question? –  James R. Mar 5 '12 at 8:13
    
@JamesR - read the help page. –  nbubis Jun 10 '12 at 6:54
add comment

Gander and Gautschi present MATLAB code for two different adaptive quadrature methods. One is based on Simpson's rule, while the other is based on the Gauss-Lobatto rule with a Kronrod extension (a modification of the usual Gaussian quadrature method). It should be straightforward to modify the code given in that paper to have it evaluate your integral.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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