Trapezoidal Rule (just need to check my answer)

  • Thread starter Thread starter DivGradCurl
  • Start date Start date
AI Thread Summary
The discussion focuses on using the Trapezoidal Rule with n=10 to approximate the integral of cos(πx) from 0 to 20, which yields a result of 20, while the actual value is 0. The discrepancy is attributed to the low value of n, as a higher n is necessary for accuracy, specifically n ≥ 82 for one decimal place. Additionally, the oscillatory nature of the integrand necessitates a higher sampling frequency to avoid inaccuracies. The conversation emphasizes the importance of selecting an appropriate n to improve approximation results in numerical integration.
DivGradCurl
Messages
364
Reaction score
0
Problem

Use the Trapezoidal Rule with n=10 to approximate

\int _0 ^{20} \cos ( \pi x) \: dx

Compare your result to the actual value. Can you explain the discrepancy?

My work

The actual value can be found as follows

\int _0 ^{20} \cos ( \pi x) \: dx = \left. \frac{\sin ( \pi x)}{\pi} \right] _{x=20} - \left. \frac{\sin ( \pi x)}{\pi} \right] _{x=0} = 0

Next, we have the Trapezoidal Rule with n=10

T_{10} = \left( \frac{20-0}{10\cdot 2} \right) \left[ \cos (0\cdot \pi) + 2\cos (2\cdot \pi) + 2\cos (4\cdot \pi) + \dots + 2\cos (16\cdot \pi) + 2\cos (18\cdot \pi) + \cos (20\cdot \pi) \right] = 20

Can I just say that the reason for the discrepancy is the low value of n ? According to the error bound, we have

\left| E_T \right| \leq \frac{K(b-a)^3}{12n^2} < \left| \mbox{ error } \right| \Longrightarrow \frac{1\cdot (20-0)^3}{12 n^2} < 10^{-1} \Rightarrow n \geq 82

which shows that in order to achieve accuracy to within one decimal place, it is required to have n \geq 82.

Is that it?

Thank you

PS: I should have calculated that for the first digit...

\left| E_T \right| \leq \frac{K(b-a)^3}{12n^2} < \left| \mbox{ error } \right| \Longrightarrow \frac{1\cdot (20-0)^3}{12 n^2} < 10^{0} \Rightarrow n \geq 26
 
Last edited:
Physics news on Phys.org
Can I also say that the need for a higher value of n is due to the oscillatory integrand?

Thanks
 
thiago_j said:
Can I also say that the need for a higher value of n is due to the oscillatory integrand?

Thanks


I think yes, you can.

I do not remember the name of theorem concerning transfer of information which says that the sampling frequency should be at least twice that of the highest-frequency Fourier component of the signal to be transmitted.

Your sampling frequency here is the same as the frequency of the function. It is the worst choice possible as it gives the same values at each point, like a constant function would do.

ehild
 
TL;DR Summary: I came across this question from a Sri Lankan A-level textbook. Question - An ice cube with a length of 10 cm is immersed in water at 0 °C. An observer observes the ice cube from the water, and it seems to be 7.75 cm long. If the refractive index of water is 4/3, find the height of the ice cube immersed in the water. I could not understand how the apparent height of the ice cube in the water depends on the height of the ice cube immersed in the water. Does anyone have an...
Thread 'Variable mass system : water sprayed into a moving container'
Starting with the mass considerations #m(t)# is mass of water #M_{c}# mass of container and #M(t)# mass of total system $$M(t) = M_{C} + m(t)$$ $$\Rightarrow \frac{dM(t)}{dt} = \frac{dm(t)}{dt}$$ $$P_i = Mv + u \, dm$$ $$P_f = (M + dm)(v + dv)$$ $$\Delta P = M \, dv + (v - u) \, dm$$ $$F = \frac{dP}{dt} = M \frac{dv}{dt} + (v - u) \frac{dm}{dt}$$ $$F = u \frac{dm}{dt} = \rho A u^2$$ from conservation of momentum , the cannon recoils with the same force which it applies. $$\quad \frac{dm}{dt}...
Back
Top