You will submit one file to Gradescope:
student.py
It must define the required functions with the exact signatures described below.
You may use:
numpympmath
(You may use standard library modules too.)
Implement these functions in student.py:
def composite_simpson(f, a, b, n_panels):
"""Composite Simpson's rule with n_panels panels (2 subintervals per panel)."""
def gauss_legendre(f, a, b, n_nodes):
"""Gauss-Legendre quadrature with n_nodes on [a,b]."""
def romberg(f, a, b, n):
"""Romberg integration; return R[n,n]."""
def equispaced_interpolant_values(f, n, x_eval):
"""Evaluate the degree-n interpolant at equispaced nodes on [-1,1] at x_eval."""
def chebyshev_lobatto_interpolant_values(f, n, x_eval):
"""Evaluate the degree-n interpolant at Chebyshev-Lobatto nodes on [-1,1] at x_eval."""
def poly_integral_from_values(x_nodes, y_nodes):
"""Return integral over [-1,1] of interpolating polynomial through (x_nodes, y_nodes)."""If you have Python 3.10+:
pip install -r requirements.txt
pytest -qThe included tests are only a small public subset of what Gradescope will run.
fwill be called with scalar floats.- Your implementations should not print during grading.
- Use numerically stable interpolation (barycentric strongly recommended).