Integration Error - Math Prelims Q4

I am working on question 4 for the first set of homework and am not sure I am getting the correct graphs.

For the analytical integration error I substituted the sinh(x) in the integral with x - x^3/3! + x^5/5! and then computed the integral of sin(x) - (x - x^3/3! + x^5/5!) from 0 to xi.

For the approximate integration error my change of variable equation was x(xi) = xi^2 + xi. For the summation of sinh(xi)*W, I again substituted x - x^3/3! + x^5/5! for sinh(x) and then plugged in my x(xi) equation for x. Then I performed quadrature for n=1,2,3 and subtracted those results (0,0.5483, 0.4484 respectively) from the integral of sin(x) from 0 to xi. The graphs don’t really look like what I was expecting.

Hi @KirkB. If you could do two things for me that would greatly help me as well as the other TAs in the future.

  1. Could you upload the graphs so that I can look at them and understand better what you mean?

  2. Please use Latex formatting so that it is easier to read your equations. This can be done by using dollar signs to enter math mode. For example $x(\xi) = \xi^2 + \xi$ results in x(\xi) = \xi^2 + \xi. Latex is just a great skill to have.

Let me dig through what you said here more and I provide more answers

First thing that I notice, where are you getting that change of basis? That is way more complicated than you need. Just use x(\eta) = \frac{\xi}{2} (1 + \eta) where \eta\in[-1,1] so that you can apply the quadrature rule since those require things to be defined over the interval [-1,1].

Thanks @kyle for responding.

Here is the graph for the analytical integration error:


This is a plot of the solved integral from 0 to \xi, which was -cos(\xi) - (\xi^6/720) + (\xi^4/24) - (\xi^2/2) + 1.

Here are the graphs for the approximate integration error (n=1,2,3):

I got my change of basis by saying x(\xi) = a\xi + b where x(-1) = 0 and x(1) = \xi. This yields these matrices \begin{bmatrix} -1 & 1\\ 1 & 1 \end{bmatrix} \begin{bmatrix} a\\ b \end{bmatrix} = \begin{bmatrix} 0\\ \xi \end{bmatrix} where inverting the matrix got me a = \xi and b = \xi. I plugged those into the x(\xi) equation to get \xi^2 + \xi.

How would your x(\eta) equation look when substituted into the quadrature rule? Especially the \xi over 2 part?

Ah, I see. Two corrections.

  1. The \xi is x(\xi) is different from the \xi used for the interval [0,1]. That is why I switched it to \x(\eta) instead.
  1. There must have been a mistake in inverting the matrix. That is a great method that you used, but the correct answer should be a = \frac{\xi}{2} and b=\frac{\xi}{2} which results in what I gave you. You can check this answer by substituting a and b back in. If you substitute your answer back in you will find that your answer does not satisfy the equation. I have a feeling you missed the determinant of the matrix when you inverted the matrix.

Sorry, for some reason I had to break that message up into two messages for it to format properly

I figured out where I went wrong. It wasn’t the inverse of the matrix, it was solving using the inverse of the matrix (it has been a while since I have taken linear algebra).

Ok, so a = \xi/2 and b = \xi/2. When substituting x(\eta) = (\xi/2)(1 + \eta) into quadrature what do I do with \eta ? Is that \xi_i? If so what does my other \xi represent?

Am I correct in substituting \xi - \xi^3/3! + \xi^5/5! in for sin^h(\xi)?

This problem was a little confusing in how it was written. All we are trying to do is compute \int_0^\xi \sin^h(x) dx. This needs to be mapped from [0,\xi] to [-1,1]. That is all that our mapping is doing.

\int_0^\xi \sin^h(x) dx=\int_{-1}^1 \sin^h(x(\eta)) \frac{dx}{d\eta}d\eta = \frac{\xi}{2}\int_{-1}^1 \sin^h(x(\eta))d\eta

From there just apply the quadrature rule.

\int_0^\xi \sin^h(x) dx= \frac{\xi}{2}\sum_{i=1}^n \sin^h(x(\eta_i))W_i

Often the scaling \frac{dx}{d\eta} gets pulled into the weight W_i which might be part of the confusion