An archived instance of a Calc II forum

Your numerical integral

mark

(10 pts)

In this problem, you’re going to work out an integral numerically from start to finish. To get your specific problem, choose your name from the following menu:

audrey

My integral is

\int_1^3 e^{-2x^2} \, dx.

Here’s a graph of the integrand f, together with f''(x):

Over the interval [1,3], it sure looks like

|f''(x)| < 2.

So I can take M_2 = 2. Now, our error bound says

\text{error} \leq M_2\frac{(b-a)^3}{24n^2} = \frac{16}{24 n^2} \stackrel{\color{red}\text{want}}{\leq} \frac{1}{1000}.

Solving that equation for n, we find that we need

n \geq \sqrt{16000/24} \approx 25.8199.

Thus, we’ll take n = 26 and break the interval from 1 to 3 up into 26 parts to get

\Delta x = \frac{2}{26} = \frac{1}{13}\text{ and } x_i = 1 + \frac{i}{13}.

This yields the approximation

\int_1^3 e^{-2x^2} \, dx \approx \sum_{i=1}^{26} e^{-2\left(1 + \frac{\frac{i}{13}+\frac{i-1}{13}}{2}\right)^2} \approx 0.02838.

Note that the final approximation was computed with this code.

knguyen3

My integral: \int_0^2 \sqrt{1+x^4}\ dx
Here is the graph of f and f^"(x):

Over the interval [0, 2]:
|f^"(x)| < 3
,so M_2=3.f
n\geq \sqrt{27000/24} \approx33.54
I’ll take n=34, so \Delta x= \frac{2}{34}= \frac{1}{17}, \text{and } x_i= \frac{i}{17}
The result is:
\int_0^2 \sqrt{1+x^4} \approx \sum_{i=1}^{34} \sqrt{1+(\frac{\frac{i}{17} + \frac{i-1}{17}}{2})^4} \approx \sum_{i=1}^{34} \sqrt{1+ (\frac{2i-1}{34})^4} \approx 3.6529

This is the code.

rtaylor4

My integral is

f(x)=\int ^2_0\sqrt{16-x^2}dx

Here is the graph of f and f"(x)

Over the interval [0,2], it appears to be |f''(x)| < 1 So M1 = 1. The error bound says error < or = M1 (b-a)^2/n = 4/n < or = 1/1000 Solving for n, we need n > or = 4000. We'll take n=4000 and break the interval from 0 to 2 up into 4000 parts to get delta(x) = 2/4000=1/2000 and xi= 0 + i/2000 This yields the approximation ~~ 7.6527. This was computed using this code: f(x) = (16-x^2)^(1/2) a = 0; b = 2; n = 4000;

xi = a;
dx = (b-a)/n;
sum = 0;
for i in range(n):
xi = xi+dx;
sum = sum + f(xi)
N(sum*dx)

Apologies this is not formatted at the moment, I will improve on it. I struggled with getting any formatting to work successfully.

chowell1

My integral is

\int^1_{-1}\sqrt{1+x^4}dx

The graph of this (red) and f''(x) (blue) is shown below:

From this it seems that over the interval [-1,1],

|f''(x)| < 3.

So we can take M_2 = 3. The error bound for a midpoint sum states

\text{error} \leq M_2\frac{(b-a)^3}{24n^2} = 3*\frac{8}{24 n^2} \stackrel{\color{red}\text{want}}{\leq} \frac{1}{1000}

When solving the equation for n we find that

n\geq \sqrt{24000/24}\approx31.6228

well round up and make n = 32. We’ll then break up the interval from -1 to 1 into 32 parts to get

\Delta x = \frac{2}{32} = \frac{1}{16}\,\text{and}\, x_i = -1 +\frac{i}{16}.

This yields the approximation

\int^1_{-1}\sqrt{1+x^4}\,dx \approx \sum_{i=1}^{16}\sqrt{1+\frac{(-1+\frac{i}{16}) +(-1+\frac{i-1}{16})}{2}}\approx 2.1783

This code I used to calculate this was here: Sage Cell Server.

mearing

My integral is

\int_{1}^{2}sin({\pi}x)dx

My graph of f and f''(x):

I can set my M_{2}=10

error \le M_{2}\frac{(b-a)^3}{24n^2}=\frac{10}{24n^2}\le \frac{1}{1000}
n \ge \sqrt{\frac{1250}{3}}\approx20.412

Using n=21 to find \Delta x and x_i, yields:

\Delta x = \frac{2-1}{21} = \frac{1}{21} x_i=1+ \frac{i}{21}

Midpoint approximation:

\int_{1}^{2}sin({\pi}x)dx\approx\displaystyle\sum_{i=1} ^{21}sin(\pi\frac{(1+\frac{i}{21})+(1+\frac{i+1}{21})}{2})\frac{1}{21}\approx-0.63721

https://sagecell.sagemath.org/?z=eJwljUsKhEAMRPcNfYcsE0X8LG28wtyhpacli8mIIuT4U45ZpF4VFFXZhRY61XjXxiWGDDsmWiFTisFuHQExuIIzsDiA1y5Lb7Dn9YEfQPV7kJIaHdm2N5vMMRDu33Rti6cneCr3b6mya1e8nzD-YmRNcfkByGMljQ==&lang=sage&interacts=eJyLjgUAARUAuQ==

afernan2

An image of the function (in red) and it’s first and second derivative
|f"(x)|<3...f"(x)=\dfrac{6x^2}{\sqrt{x^4+1}}-\dfrac{4x^6}{\left(x^4+1\right)^\frac{3}{2}}
Error Calculation: M2 =3, n=>\sqrt(\frac{27000}{34})=33.5

n=34 \frac{2}{34}=\frac{1}{17},

This gives us the equation \int_0^2 \sqrt{1+x^4} \, dx \approx \sum_{i=1}^{34} \sqrt{1+(i/17+(\frac{2i-1}{34})^4}=3.6848
Code: Sage Cell Server
f(x) = sqrt(1+x^4)
a = 0; b = 2;
n = 34;

xi = a;
dx = (b-a)/n;
sum = 0;
for i in range(n):
xi = xi+dx;
sum = sum + f(xi)
N(sum*dx)
I have confused myself.

ccase2

My integral is

\int_{-1}^1 \frac1{1+x^4}dx

Here’s a graph of f, together with f'(x)

Over the interval [-1,1], it looks like

|f'(x)|<1.5

So I can take M_1=1.5. Now my error bound says

\text{error} \leq M_1\frac{(b-a)^2}{n}=\frac6n \stackrel{\color{red}\text{want}}{\leq} \frac1{1000}

solving for n, I find that I need

n \geq 6000

Thus, I’ll take n=6000 and break the interval from -1 to 1 up into 6000 parts to get

\Delta x = \frac2{6000}= \frac1{3000} \text{ and } x_i = -1+\frac{i}{3000}

This yields the approximation

\int_{-1}^1 \frac1{1+x^4}dx \approx \sum_{i=1}^{6000} \frac1{1+(-1+\frac{i-1}{3000})^4} \approx 1.73395

The final approximation was computed with this code: Sage Cell Server

rstahles

My integral is:

\int_0^2 \sqrt{1+x^4} \, dx.

Here’s a graph of the integrated f, together with f''(x):

Over the interval [0,2], it looks like:

|f''(x)|<3

So, we can take M_2=3. Now, our error bound says:

\text{error} \leq M_2\frac{(b-a)^3}{24n^2} = \frac{24}{24 n^2} \stackrel{\color{red}\text{want}}{\leq} \frac{1}{1000}.

Solving that equation for n, we will find that we need:

n \geq \sqrt{24000/24} \approx 31.6228.

Thus, we’ll take n=32 and break the interval from 0 to 2 up into 32 parts to get:

\Delta x = \frac{2}{32} = \frac{1}{16}\text{ and } x_i = 0 + \frac{i}{16}.

This yields the approximation:

\int_0^2 \sqrt{1+x^4} \, dx \approx \sum_{i=1}^{32} \sqrt{1+\left(\frac{\frac{i}{16}+\frac{i-1}{16}}{2}\right)^4} \approx 3.65285.

Note that the final approximation was computed with this code.

gbelk

my integral is

∫^1_{-1}1/(1+x^4) dx

Here’s a graph of the integrand f , together with f"(x)


Over the interval [-1,1],

|f''(x)|<3

So I can take M_2 = 3 . Now, our error bounds says

error≤ M_2 (b-a)^3 /24n^2 = 24/24n^2 ≤ 1/1000

Solving that equation for n , we find that we need

n≥ \sqrt{24000/24} ≈31.6228

Thus, we’ll take n=32 and break the interval from -1 to 1 up into 32 parts to get

Δx = 2/32=1/16and x_i= 1+ i/16

this yields the approximation

\int^1_{-1}1/(1+x^4) dx ≈\sum^{32}_{i=1}1/(1+(1+(((i/13)+(i-1)/13)/2)^4) ≈4.81199

https://sagecell.sagemath.org/?z=eJwljcEKAjEMRO-F_kOOiWVZq54s_sJ-gtClW8nBKCtCPt9xN4fMm4FhOrvQjRZ_cx45J79fRGKoyIZcaIbmEoNBzydADK7gCmwO4HmoMhrs5_uEP4L6ayUlNVqrPRY2ucZAuK3pmpqXPdgr_5-osyuGJ4Y9NJcfkwwk8A==&lang=sage&interacts=eJyLjgUAARUAuQ==

myost

my integral is

\int_1^2 \sin(\pi*x) \, dx.

Here is the graph of f(x) and f’(x):

Over the interval [1,2] it looks like

|f’(x)| < 4

So, M1 = 4. Now, our error bound says

\text{error} \leq M_1\frac{(b-a)^2}{n} = \frac{4}{n} \stackrel{\color{red}\text{want}}{\leq} \frac{1}{1000}.

Solving that equation for n, we find that

n \geq \ 4000

Thus, we’ll take n=4000 and break the interval from 1 to 2 up into 4000 parts to get

\Delta x = \frac{1}{4000}\text{ and } x_i = 1 + \frac{i}{4000}.

This yields the approximation

\int_1^2 \sin{(\pi*x)} \, dx \approx \sum_{i=1}^{4000} \sin{\pi*(\frac{i}{4000})}\ \approx -0.636619739642658

Note that the final approximation was computed with Sage Cell Server

cbrowni1

My integral is

\int^1_{-1}cos(x^4)dx

Here is a graph of the integrand f, together with f''(x):

Over the interval [-1,1], it looks like

|f''(x)| < 20

So I can take M_2 = 20. Now, our error bounds says

\text{error} \leq M_2\frac{(b-a)^3}{24n^2} = \frac{160}{24 n^2} \stackrel{\color{red}\text{want}}{\leq} \frac{1}{1000}

Solving for n, we find that we need

n \geq \sqrt{160000/24} \approx 81.649658

Now we will take n=82 and break the interval from -1 to 1 up into 82 parts to get

\Delta x = \frac{2}{82} = \frac{1}{41}\text{ and } x_i = -1 + \frac{i}{41}.

This yields the approximation

\int^1_{-1}cos(x^4)\,dx \approx \sum_{i=1}^{82}cos(({-1+\frac{(-1+\frac{i}{41}) +(-1+\frac{i-1}{41})}{2}})^4)\approx 1.894

The final approximation was computed using this code.

nhaley

My integral is:

\int_0^2 \sqrt{16-x^2} dx

Here’s a graph of the integrand f, together with f, together with f''(x).

Over the interval [0,2], it sure looks like |f''(x)|<1

So I can take M_2 =1. Now, our error bound says,

\text{error} \leq M_2 \frac{((b-a)^3)}{(24n^2)} = \frac{8}{24n^2} \stackrel{\color{red}\text{want}}{\leq} \frac{1}{1000}.

Solving that equation for n, we find that we need,

n \geq \sqrt{8000/24} \approx{18.2574}.

Thus we’ll take n =18 and break the interval from 0 to 2 up into 18 parts to get,

\Delta x = \frac{2}{18} = \frac{1}{9} \text{ and } x_i = \frac{i}{9}.

This yields the approximation,

\int_0^2\sqrt{16-x^2}dx \approx \sum_{i=1}^{18} \sqrt{16-(\frac{\frac{i}{9}+\frac{i-1}{9}}{2})^2} )*\frac{1}{9}\approx 7.65319.

Note that the final approximation was computed with this code.

jlajcin

My integral is

\int_2^4 \sqrt{16-x^2} dx

Here is a graph of the f(x) and f''(x):

Over the interval [2,4] it looks like

|f'(x)|<1

So, M1=1. Now, our error bound says

\text{error} \leq M_1\frac{(b-a)^2}{n} = \frac{4}{n} \stackrel{\color{red}\text{want}}{\leq} \frac{1}{1000}.

Solving that equation form, we find that

n\geq\ 4000

Thus, we’ll take n=4000 and break the interval from 2 to 4 into

\Delta x = \frac{2}{4000}\text{or} \frac{1}{2000}\text{ and } x_i = 2 + \frac{i}{2000}.

This yields the approximation

\int_2^4 \sqrt{(16-x^2)} \, dx \approx \sum_{i=1}^{4000} \sqrt{16-(\frac{i}{2000})^2}\ \approx4.9126

The final approximation was computed with this code

mwilli23

My intergral is

\int_0^2 e^{-x^2}\, dx.

Here’s a graph of the integrand f, together with f''(x)

Over the interal [0,2], it looks like

|f''(x)| <1

So I can take M_2 = 1. Now, our error bound says

\text{error} \leq M_2\frac{(b-a)^3}{24n^2} = \frac{8}{24 n^2} \stackrel{\color{red}\text{want}}{\leq} \frac{1}{1000}.

Solving that equation for n, we find that we need

n \geq \sqrt{8000/24} \approx 18.2574.

We take n=19 and break the interval from 0 to 2 up into 19 parts to get

\Delta x = \frac{2}{19} = \frac{2}{19}\text{ and } x_i = 0 + \frac{2i}{19}.

This yields the approximation

\int_0^2 e^{-x^2} \, dx \approx \sum_{i=1}^{19} e^{-\left( \frac{1+\frac{2i}{19}+\frac{2i-1}{19}}{2}\right)^2} \approx 0.8821151 .

The final approximation was computed with this code.

fcarrill

:grin:My Integral is:

\int_0^1sin(\pi x)dx

:nerd_face:The graph is f(Orange) and f′′(x)(Green) is shown below:

:face_with_raised_eyebrow:The interval is over [0,1] it looks like
|f''(x)|<10
:astonished:So I set M_2=10
error \leq M_2 \frac{(b-a)^3}{24n^2}=\frac{10}{24n^2} \stackrel{\color{red}\text{want}}{\leq} \frac{1}{1000}
n \geq \sqrt{\frac{1250}{3}}\approx20.412
:grin:Using n= 20 and break the interval from 0 to 1 up into 20 parts to get
\Delta x = \frac{1}{20}\text{ and } x_i = 1 + \frac{i}{20}.
This yields the approximation
\int_{0}^{1}sin({\pi}x)dx\approx\displaystyle\sum_{i=1} ^{20} sin(\pi\frac{(1+\frac{i}{20})+(1+\frac{i+1}{20})}{2})\frac{1}{20}\approx0.6372
:partying_face:Note that the final approximation was computed with Sage Cell Server

gwebb

My integral is

\int_{0}^{2} \sqrt{1+x^4} dx

Over the interval [0,2] it looks like

|f'(x)|<4

So I will set

M_1 = 4

The error bound for a left sum states

error \leq M_1 \frac{(b-a)^2}{n} = \frac{16}{n} \leq \frac{1}{1000}

So,

n \geq 16000

So I’ll take n = 16000 and break the interval 0 to 2 into 16000 parts

\Delta x= \frac{2}{16000} =\frac{1}{8000}
x_i = 0 + \frac{2i}{8000}

This yields the approximation

\int_{0}^{2} \sqrt{1+x^4} dx \approx \sum_{i=0}^{15999}\sqrt{1+(\frac{i^4}{4096000000000000})}/8000 \approx 3.653289

Sage code: Sage Cell Server

mark