Calculus And Computer Science?

Calculus Level 4

0 π sin 20 x d x \large \displaystyle \int_{0}^{\pi} \sin^{20}x \, dx

The integral above has a closed form. Find this closed form.

Give your answer to 3 decimal places.

Bonus : Compute 0 π sin 80 x d x \displaystyle \int_{0}^{\pi} \sin^{80}x \, dx .

Try a harder version here: Calculus and Computer Science Again?


The answer is 0.55354.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Rishabh Jain
May 7, 2016

I n = 0 π sin n x d x = 0 π sin n 1 x sin x d x \large I_n=\displaystyle\int_0^{\pi}\sin^n x\mathrm{d}x\\=\large\displaystyle\int_0^{\pi}\sin^{n-1}x\color{#D61F06}{ \sin x}\mathrm{d}x Using Integration by Parts:- I n = sin n 1 x cos x 0 π 0 + ( n 1 ) 0 π sin n 2 x cos 2 x 1 sin 2 x d x I_n=\underbrace{-\sin^{n-1} x\cos x|_0^{\pi}}_{\large 0}+(n-1)\displaystyle\int_0^{\pi}\sin^{n-2}x\underbrace{\cos^2x}_{\color{teal}{1-\sin^2 x}}\mathrm{d}x

I n = ( n 1 ) ( I n 2 I n ) \implies I_n=(n-1)(I_{n-2}-I_{n}) I n = n 1 n ( I n 2 ) \large \implies I_n=\dfrac{n-1}{n}(I_{n-2})

Hence,

I 20 = ( 19 20 ) × ( 17 18 ) × ( 15 16 ) × × ( 1 2 ) × I 0 π I_{20}=\left(\dfrac{19}{20}\right)\times\left(\dfrac{17}{18}\right)\times\left(\dfrac{15}{16}\right)\times\cdots\times\left(\dfrac{1}{2}\right)\times \underbrace{I_0}_{\large \pi}

= 46189 π 262144 0.55354 \large =\dfrac{46189\pi}{262144}\approx \boxed{0.55354}


Generalised form:- I n = ( n 1 ) ! ! π n ! ! \Large I_n=\dfrac{(n-1)!!\pi}{n!!}

(where ! ! !! is double factorial notation).

Adding to your solution, the recursive function to evaluate I n I_{n} in C++:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <iostream>

using namespace std;

float recint(int n)
{
    float ans;
    if(n==0)
        return 3.1415;
    ans=(n-1)*recint(n-2)/n;
    return ans;
}
int main()
{
    cout << recint(20) << " " << recint(80);
    return 0;
}

Output :

0.553523 0.553523 and 0.279367 0.279367 respectively for I 20 I_{20} and I 80 I_{80} in 0.686s.

Kunal Verma - 5 years, 1 month ago

Bonus : Calculate I 80 I_{80}

Kunal Verma - 5 years, 1 month ago

Log in to reply

I 80 0.279375 ( = 79 ! ! π 80 ! ! ) . I_{80}\approx 0.279375~~ (=\dfrac{79!!\pi}{80!!}).

Rishabh Jain - 5 years, 1 month ago

Shall I delete it ... ?? (As it does not involve programming obviously)..

Rishabh Jain - 5 years, 1 month ago

Log in to reply

No. Programming is appreciated but not necessary. You gave a valid solution and that's what matters I think.

Kunal Verma - 5 years, 1 month ago

about the generalised form is that I n { I }_{ n } is not true when n n is odd.

Joel Yip - 4 years, 6 months ago

I = 0 π sin 20 x d x = 0 π ( 2 sin ( x 2 ) cos ( x 2 ) ) 20 d x Let θ = x 2 d θ = 1 2 d x = 2 21 0 π 2 sin 20 θ cos 20 θ d θ = 2 20 B ( 21 2 , 21 2 ) B ( m , n ) is Beta function = 2 20 Γ 2 ( 21 2 ) Γ ( 21 ) Γ ( n ) is Gamma function = 2 20 ( 19 ! ! 2 10 ) 2 π 20 ! = ( 19 ! ! ) 2 π 20 ! = 19 ! ! π 2 10 10 ! 0.554 \begin{aligned} I & = \int_0^\pi \sin^{20} x \, dx \\ & = \int_0^\pi \left(2\sin \left(\frac{x}{2} \right) \cos \left(\frac{x}{2} \right) \right)^{20} \, dx \quad \quad \small \color{#3D99F6}{\text{Let }\theta = \frac{x}{2} \implies d\theta = \frac{1}{2} \ dx} \\ & = 2^{21} \int_0^{\frac{\pi}{2}} \sin^{20} \theta \cos^{20} \theta \ d\theta \\ & = 2^{20} B \left(\frac{21}{2}, \frac{21}{2} \right) \quad \quad \small \color{#3D99F6}{B(m,n) \text{ is Beta function}} \\ & = \frac{2^{20} \Gamma^2 \left(\frac{21}{2} \right)}{\Gamma (21)} \quad \quad \small \color{#3D99F6}{\Gamma (n) \text{ is Gamma function}} \\ & = \frac{2^{20}\cdot \left(\frac{19!!}{2^{10}}\right)^2\pi}{20!} \\ & = \frac{(19!!)^2\pi}{20!} \\ & = \frac{19!!\pi}{2^{10}10!} \approx \boxed{0.554} \end{aligned}


General form: I n = 0 1 sin n ( x ) d x = ( n 1 ) ! ! π n ! ! \ \ I_n = \displaystyle \int_0^1 \sin^n (x) \ dx = \frac{(n-1)!!\pi}{n!!}

Firstly, for the general form, the upper limit is pi and the generalised form is not true when n n is odd.

Joel Yip - 4 years, 6 months ago

Since you wanted a Computer Science solution:

1
2
3
4
5
6
7
8
9
import math
def f(x):
    return (math.sin(x))**20
i=0
s=0
while(i<3.14159265):
    s += abs(f(i))*0.000001
    i += 0.000001
print(s)

Bonus:

1
2
3
4
5
6
7
8
9
import math
def f(x):
    return (math.sin(x))**80
i=0
s=0
while(i<3.14159265):
    s += abs(f(i))*0.000001
    i += 0.000001
print(s)

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...