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.

I am having trouble integrating

\begin{aligned}
\ \int_{0}^{\pi/2} x^{1/2} \cos x\, dx \end{aligned}

I see I can use the Trapezoidal or Simpson's Rule to approximate the integral, but when I used the Trapezoidal Rule, I got .6366 for n=4. I understand there should be some margin of error because I am only using 4 trapezoids, but the real answer is .7040 according to Wolfram. It seems my answer is a bit beyond what I expected - I thought I would be closer to the .7040 value.

Wolfram Link: http://www.wolframalpha.com/input/?i=integrate+sqrt%28x%29+cos+x+dx+from+0+to+pi%2F2

When I used Simpson's Rule, I got .6847 when n=4.

Edit: I resolved my own error - it was a simple button punching error (I made it for Simpon's Rule and Trapezoidal Rule - twice (I did the problem over again, too)).

share|improve this question
    
If anyone could fix my title, that would be nice. I'm not sure where I made a formatting error. –  Joe Feb 21 '12 at 0:47
2  
$n = 4$ isn't enough because the integrand changes quickly near $x = 0$. You need to subdivide more finely near $x = 0$ to capture this. –  Qiaochu Yuan Feb 21 '12 at 0:49
    
Thanks for the title fix David Mitra. –  Joe Feb 21 '12 at 0:55
1  
I resolved my own error - it was a simple button punching error (I made it for Simpon's Rule and Trapezoidal Rule - twice (I did the problem over again, too)). –  Joe Feb 21 '12 at 1:06
    
@Jay Electronics: To add to the comment by Qiaochu Yuan, many numerical integration packages use more points where the function is changing most rapidly (adaptive integration). –  André Nicolas Feb 21 '12 at 1:35
add comment

2 Answers 2

up vote 4 down vote accepted

It can be expressed in "closed form" as $\sqrt{\pi/2}(1 - \text{FresnelS}(1))$ or $$\sqrt{\frac{\pi}{2}} \left(1-\frac{\pi}{6} \ {\mbox{$_1$F$_2$}\left(\frac34;\frac32,\frac74;-\frac{\pi^2}{16}\right)}\right)$$

share|improve this answer
add comment

You should get a good approximation with

$${x^{1/2}}\cos x \sim {x^{1/2}}\left( {1 - \frac{{{x^2}}}{{2!}} + \frac{{{x^4}}}{{4!}}} \right)$$

since for $x\in(0,\pi)$ the error of the polynomial is at most $0.025$ .

This gives

$$\eqalign{ & \int\limits_0^{\frac{\pi }{2}} {{x^{1/2}}\left( {1 - \frac{{{x^2}}}{{2!}} + \frac{{{x^4}}}{{4!}}} \right)} dx = \int\limits_0^{\frac{\pi }{2}} {\left( {{x^{1/2}} - \frac{{{x^{5/2}}}}{{2!}} + \frac{{{x^{9/2}}}}{{4!}}} \right)} dx = \cr & \left[ {\frac{2}{3}{x^{3/2}} - \frac{1}{7}{x^{7/2}} + \frac{1}{{12}}\frac{{{x^{11/2}}}}{{11}}} \right]_0^{\frac{\pi }{2}} \approx 0.709328026752218 \cr} $$

If you include the next term in the Taylor polynomial (the error is at most $0.0011$) you get $0.703851503882453$ which is quite enough.

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.