{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "wound-local",
   "metadata": {},
   "source": [
    "# The Recursive Trapezoid Rule, with error control\n",
    "\n",
    "**Notes added on Thursday March 25**"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "victorian-lighting",
   "metadata": {},
   "source": [
    "Write a function that uses the Recursive Trapezoid Rule, $R_m = T_{2^m}$ to estimate a definite integral with a specified absolute error tolerance.\n",
    "\n",
    "- The input should specify the function $f$ and interval $[a,b]$, and also the error tolerance.\n",
    "\n",
    "- The output should include the approximate answer, estimated error, and also the number of evaluations of $f(x)$, as a measure of cost."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "impossible-robinson",
   "metadata": {},
   "source": [
    "**Added note:**\n",
    "\n",
    "Recall the formula\n",
    "\n",
    "$$\n",
    "T_{2n} = (T_n + M_n)/2\n",
    "$$\n",
    "\n",
    "so\n",
    "\n",
    "$$\n",
    "R_m = T_{2^m} = \\frac{T_{2^{m-1}} + M_{2^{m-1}}}{2}\n",
    "$$\n",
    "\n",
    "which makes the evaluations more efficient.\n",
    "Thus, a useful first step is to write a Python function for  the Composite Midpoint Rule,\n",
    "\n",
    "    def midpoint(f, a, b, n):\n",
    "        ...\n",
    "        return M_n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
