0

For every $x_i$ where i=1,..,5 there exists a corresponding weight $w_i$. I am trying to calculate numerically the continuous integral $$\int x^2w \, dx$$ How would the numerical integral look like? I have used the trapezoidal rule but I cannot understand how the weights correspond. Please have a look at the numerical integration I have according to trapezoidal rule: $$\sum_{i=0}^5 w_i( \frac{(x_i+x_i+1)}{2})^2$$ The problem is that this way, only four of the weights will be used. How would it be correct to assign each weight to each discretized value? Thank you in advance.

1 Answers1

1

For any rule, if you are integrating $f(x)$ (here $x^2)$ with intervals of width $a$, the approximation is $$a\sum w_if(x_i)$$ If you are using the trapezoidal rule with six points, two of them the endpoints, you have $w_0=w_5=\frac 12,$ and all the other $w_i$ are $1$. If your range is from $0$ to $5$ the intervals have width $1$, so you would have $$(1)\sum_{i=0}^5w_ix_i^2=(1)\left(\frac 12\cdot0^2+1\cdot 1^2+1 \cdot 2^2+1\cdot 3^2+1\cdot 4^2+\frac 12\cdot 5^2\right)=\frac {93}2$$ The exact value is $$\int_0^5x^2dx=\left.\frac {x^3}3\right|^5_0=\frac {125}3$$

Ross Millikan
  • 374,822
  • @thalianouni: only part of your comment came through and I cannot see your question. If you hit a return the comment is posted. Please comment again – Ross Millikan May 01 '19 at 13:52