Skip to main content

Exercises 18.4 Homework

1.

Rewrite Example 18.2.1 so that the number of subintervals \(n\) can be entered by the user. The input should be rejected with error('n must be even') if an odd number is entered. The command mod(n, 2) will be useful for checking this. The code producing the weights w, v will need to be generalized so that it works for general \(n\text{.}\)

Try choosing \(n\) large enough so that the displayed integral value is 12.5419 (or at least within 0.0001 of this value). In a comment, state the value of \(n\) which achieved the above. How many evaluation points were used with this \(n\text{?}\)

2.

Use Remark 18.3.2 to find the averages of the following functions over the unit sphere in \(\mathbb R^{10}\text{:}\)

  1. \(f(\mathbf x) = x_1+\dots+x_{10}\text{,}\) the sum of coordinates.
  2. \(f(\mathbf x) = x_1^2\text{,}\) the first coordinate squared.
  3. \(f(\mathbf x) = (x_1+x_2+\dots+x_{10})^2\text{,}\) the square of the sum of all coordinates.

The Matlab function sum will be useful.

Based on the numeric results, try to guess the exact values of these averages. (You do not need to prove your guesses.)