I am trying to solve the following problem, but I can not understand it(in the school they did not teach us quadrature).

From the nodes $x_0 = \frac{2}{3}$, $x_1 = \frac{5}{9}$ and $x_2 = \frac{65}{81}$ for the quadrature formula:

$$\int_0^1{xf(x)\delta(x)} \approx A_0f(x_0)+ A_1f(x_1)+ A_2f(x_2)$$

Answer the following questions:

  • Explain how you get the coefficients $A_i$ $\forall i \in [1,2,3]$. You must use the Sympy library (Symbolic Python) to get your answer.

  • What is the maximum degree of a polynomial f for which this formula is exact?.

  • Is it a Gaussian square ?. Argue your answer.
  • Use your formula to approximate: $$ \int^1_0 xe^xd x $$ What is the error?

I have no idea how to respond to the request, if you could help me I would appreciate it. Thank you.

  • $\begingroup$ I have rolled back the edit in which you deleted the contents of the question for which you accepted an answer. That's not proper behavior here. It means no one else can take advantage of the work the answerer did for you. $\endgroup$ – Ethan Bolker Apr 19 at 14:43
  1. You get the coefficients just be demanding that the rule is exact (gives you the exact result) for polynomials up to a certain degree. Since the rule is linear in $f$, you just need to check for the polynomials $1, x, x^2, \cdots$ Since you have three coefficients to determine, you can use the system $$ \begin{cases} A_0+A_1+A_2 = \int_0^1 x \, dx\\ x_0 A_0 + x_1 A_1 + x_2 A_2=\int_0^1 x^2dx \\x_0^2 A_0 + x_1^2 A_1 + x_2^2 A_2 = \int_0^1 x^3 dx \end{cases} $$

This amounts to requiring the the rule is exact for polynomials of degree $\leq 2$. You will get $A_0=-\frac{59}{44}, A_1=\frac{81}{80}, A_2=\frac{719}{880}$.

  1. From (1) we know that the degree is a least 2. To compute the actual degree, we just test the rule for polynomials of increasing order. Using the rule for $f(x)=x^3$ does not give the correct value for the integral, so the rule has degree 2.

  2. It is not a Gaussian rule because it does not have the correct degree. If it was a Gaussian rule it would have degree 5.

  3. Using the formula with $f(x)=e^x$ you get $$ \int_0^1 x e^x dx \approx \frac{81 e^{5/9}}{80}-\frac{59 e^{2/3}}{44}+\frac{729 e^{65/81}}{880}=1.00118 $$

The correct value can be computed using integration by parts... $\int_0^1 x e^x dx = 1$, so the absolute error is $0.00118$.

  • $\begingroup$ Now, it's very clear to me. Thank you very much $\endgroup$ – Fmkit Apr 17 at 0:54
  • $\begingroup$ Hi, I was trying to understand what you explained to me and in answer 1 when solving the system with the values ​​$ x_0 $=1/3, $ x_1$ =5/9, $ x_2$ = 65/81 and I got the values $ A_0 = 0.194078947368421, $ A_1 = -0.0937500000000000 $, $ A_2 = 0.399671052631579 $ (mi code is in ideone.com/k4poaI ). I have tried it in other ways and I get the same, what can I be doing wrong? $\endgroup$ – Fmkit Apr 19 at 3:19
  • $\begingroup$ @Fmkit In your original post you have that $x_0=\frac 23$. The values you are now mentioning are correct if $x_0=\frac 13$. $\endgroup$ – PierreCarre Apr 19 at 10:22
  • $\begingroup$ You are right, it was my mistake in the original post (I have not realized it), thank you very much $\endgroup$ – Fmkit Apr 19 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.