Department of Mathematics

Math 300: Mathematical Computing

Assignment B

One Newton-Cotes rule that is not used often is called Boole's rule. Consider the integral \[\int_a^b f(x)\,dx\] where \(f\) is twice continuously differentiable. Let \(a=x_0\lt x_1\lt\dots\lt x_n=b\) be an equally-spaced partition of \([a,b]\), where we assume that \(n\) is evenly divided by 4. When \(h=(b-a)/n\) is the uniform width of the subintervals, the composite Boole rule is \[\int_a^b f(x)\,dx = \frac{4h}{90}\sum_{i=1}^{n/4} \left( 7f(x_{4i-4})+32f(x_{4i-3})+12f(x_{4i-2})+32f(x_{4i-1})+7f(x_{4i}) \right) + O(h^6). \] Write a Python function called boole that takes four arguments: an integrand function, the lower and upper limits of integration, and the value of \(n\), which returns the value of the Boole's rule approximation to the integral. Be sure your function tests whether \(n\) is divisible by 4. If not, it should print an error message, and return NaN (it is a thing in Numpy). If you prefer, you can use the raise keyword for this, but you do not have to.

This assignment is worth 35 points. Send the completed .py or .ipynb file containing the function as an attachment to an email message to the instructor by 9:00 AM on Thursday, 8 December. Remember that if you send a .py file, you must change the filename so that the extension is e.g. .txt, in order to get it through campus mail.

The last test will take place at the final exam time, Monday 12 December, 1:30-3:30. It will be written as a one-hour in-class on-line test. As usual, you can use any resources you want. A Sample Exam is available. Note that the URL for the exam will not be emailed to all. If you need to take the exam from outside class, contact the instructor to get on the email list.

Assignment B is posted.

Most recent scores are on-line at My.math. Check the Info page. Let the instructor know if you find a discrepancy.

Department of Mathematics, PO Box 643113, Neill Hall 103, Washington State University, Pullman WA 99164-3113, 509-335-3926, Contact Us
Copyright © 1996-2020 Kevin Cooper