What you would rarely want to do is change only the absolute error tolerance, AbsTol. You actually need both, or rather sometimes the one and sometimes the other, but it is good practice to think about what you want for both of them and to be aware of the default values in case you choose not to set them. One of the advantages of the integral2 routine (and its companions for other dimensions) over most of the older routines is that they provide mixed relative and absolute error control, which is to say, you can supply two tolerances instead of just one. We first adjust the numeric display to see enough decimal digits, before displaying the abolute error of the integration Q1. The analytic answer for this integral is Q0 = log(sqrt(2))/10*(exp(10) - 1)Īnd you can see that Q1 differs from Q0, perhaps more than we might want. First let's integrate the function F1 F = 0 and 1 for x and 0 and $\pi/4$ for y. We can now integrate F between 0 and 1 for both directions, x and y. If you are unfamiliar with anonymous functions and want to learn more about them, please check the categories to the right of the blog for discussions and examples. Instead of creating a file with the integrand definition, we instead create an anonymous function. So, to integrate $x * y$, you need to supply the vectorized form, i.e., x. There is at least one requirement on the integrand when you call any integration function, and that is that it can be called with multiple inputs and it will return corresponding outputs, 1-for-1, with the inputs. Requirement for Calling Integration Functions Have You Been Successful with the Newer Integration Routines?.Requirement for Calling Integration Functions.