### Chapter 5

Problems 23, 26, 27, 32, 42, 43

For problem #42, you don't have to do exactly their example. But choose a function f and a point x and make the analogue of Table 5.25.

### Problem 1:

Find a quadrature rule for a triangle where the triangle has vertices (-1,0), (1,0), and (0,1). The rule will use the function values at the vertices and at the midpoints of the edges of the triangle. Demand that your quadrature rule gets the integral exactly for as high order a polynomial in x and y as you can. Now consider an arbitrary triangle, with vertices (a_1,b_1), (a_2,b_2), and (a_3,b_3). Figure out how to transform the quadrature rule you found to one that applies for this triangle. Check that you did it right by integrating f(x,y) = xy on your triangle and comparing your answer to what you get from the transformed quadrature rule.

### Problem 2:

On the integration web-page, there are two adaptive integration programs, adaptive_trap.m and adaptive_simpsons.m Download these and try them on the function f_eps(x) = 1/(x^2+eps), integrated from -10 to 10.

• First test the routines on a function whose integral you know exactly. Present a table showing tol and error for various values of tol.
• Fix tol and eps and compare the trapezoidal method to the simpsons method --- why does one need so many more intervals than the other.
• Study the effect of changing eps on n_adaptive (the number of intervals used) and the ratio of n_uniform/n_adaptive (where n_uniform is the number of intervals you'd have to use if they were all the same length).
• Study the effect of changing tol on the number of intervals used. Plot the interval lengths (plot(h)) and verify that the itnervals are small where they should be small.