Commits

Anonymous committed 73306ff Merge

Merged many updates from master branch and added homeworks and solutions

  • Participants
  • Parent commits fe2f4b4, 544b6ff
  • Branches coursera

Comments (0)

Files changed (96)

File codes/f2py/Makefile

+
+.PHONY: clean
+
+%.so : %.f90
+	f2py -m $* -c $<
+
+clean:
+	rm -f *.so *.pyc
+

File codes/f2py/fcn1.f90

+! $UWHPSC/codes/f2py/fcn1.f90
+
+! A test function for trying out f2py:
+!   $ f2py -m fcn1 -c fcn1.f90
+!   $ python
+!   >>> import fcn1
+!   >>> fcn1.f1(1.)
+!   2.7182818284590451
+
+
+function f1(x)
+    real(kind=8), intent(in) :: x
+    real(kind=8) :: f1
+    f1 = exp(x)
+end function f1

File codes/f2py/jacobi1.f90

+
+! $UWHPSC/codes/f2py/jacobi1
+
+! For use with f2py:
+!   $ f2py -m jacobi1 -c jacobi1.f90
+! Then in Python you can import jacobi1 and use it to take a fixed number of
+! iterations using Jacobi in one space dimension to solve
+!      u(i-1) - 2*u(i) + u(i+1) = -dx**2 * f(i).
+! Python call:
+!   >>> u = jacobi1.iterate(u0, iters, f)
+! where 
+!   iters is the number of iterations to take,
+!   u0(0:n+1) is the initial guess (with desired boundary values 
+!             in u0(0) and u0(n+1), these are not changed.
+!   f(0:n+1) contains values of f(x) at each grid point.
+! 
+
+subroutine iterate(u0,iters,f,u,n)
+    implicit none
+    integer, intent(in) :: n, iters
+    real(kind=8), dimension(0:n+1), intent(in) :: u0, f
+    real(kind=8), dimension(0:n+1), intent(out) :: u
+
+    ! local variables:
+    real(kind=8), dimension(:), allocatable :: uold
+    real(kind=8) :: dx
+    integer :: i, iter
+
+    ! allocate storage for boundary points too:
+    allocate(uold(0:n+1))
+
+    ! grid spacing:
+    dx = 1.d0 / (n+1.d0)
+
+    uold = u0
+
+    ! initialize boundary values of u:
+    u(0) = u0(0)
+    u(n+1) = u0(n+1)
+
+    ! take the iterations requested:
+    do iter=1,iters
+        do i=1,n
+            u(i) = 0.5d0*(uold(i-1) + uold(i+1) + dx**2*f(i))
+            enddo
+        uold = u
+        enddo
+
+end subroutine iterate

File codes/f2py/plot_jacobi_iterates.py

+
+from matplotlib import pyplot as plt
+import numpy as np
+import time
+
+import jacobi1   # created from jacobi1.f90 using f2py
+
+n = 51
+
+# grid points:
+x = np.linspace(0., 1., n)
+
+# boundary conditions:
+alpha = 20.
+beta = 60.
+
+# initial guess:
+u = np.linspace(alpha, beta, n)
+
+# right hand side:
+f = 100. * np.exp(x)
+
+niters = 0
+plt.clf()
+plt.plot(x, u, 'o-')
+plt.title("After %s iterations" % niters)
+plt.ylim([10., 80.])
+
+ans = raw_input("Type return to start... ")
+
+iters_per_plot = 200   # number of iterations between plots
+nplots = 20            # number of plots to produce
+
+for nn in range(nplots):
+    u = jacobi1.iterate(u, iters_per_plot, f)
+    plt.plot(x, u, 'o-')
+    niters = niters + iters_per_plot
+    plt.title("After %s iterations" % niters)
+    plt.ylim([10., 80.])
+    plt.draw()
+    time.sleep(.5)
+    
+
+

File codes/f2py/sub1.f90

+
+! $UWHPSC/codes/f2py/sub1.f90
+
+! A test subroutine for trying out f2py:
+!   $ f2py -m sub1 -c sub1.f90
+!   $ python
+!   >>> import sub1
+!   >>> sub1.mysub(3., 5.)
+!   (8.0, -2.0)
+
+subroutine mysub(a,b,c,d)
+    real (kind=8), intent(in) :: a,b
+    real (kind=8), intent(out) :: c,d
+    c = a+b
+    d = a-b
+end subroutine mysub

File codes/fortran/zeroin/Makefile

+# $CLASSHG/codes/fortran/zeroin/Makefile
+
+OBJECTS = zeroin.o myfcn.o testzeroin.o
+
+FFLAGS = -g
+
+.PHONY: test plot clean clobber
+
+test: testzeroin.exe
+	./testzeroin.exe
+
+testzeroin.exe: $(OBJECTS)
+	gfortran $(OBJECTS) -o testzeroin.exe
+
+%.o : %.f
+	gfortran $(FFLAGS) -c $< 
+
+%.o : %.f90
+	gfortran $(FFLAGS) -c $< 
+
+clean:
+	rm -f *.o *.exe *.mod
+

File codes/fortran/zeroin/README.txt

+
+Test program for zeroin.
+A zero of the function  f(x)  is computed in the interval ax,bx .
+
+This function came from Netlib:
+     http://www.netlib.org/go/zeroin.f
+

File codes/fortran/zeroin/myfcn.f90

+! $CLASSHG/codes/fortran/zeroin/myfcn.f90
+
+! Provides the function power(x) = x**n - a.
+! A zero of this function will be found using zeroin.
+
+module myfcn
+
+    implicit none
+    real(kind=8) :: a
+    integer :: n
+    save
+
+contains
+
+real(kind=8) function power(x)
+
+    implicit none
+    real(kind=8) :: x
+    power = x**n - a
+
+end function power
+
+end module myfcn

File codes/fortran/zeroin/testzeroin.f90

+! $UWHPSC/codes/fortran/roots/testzeroin.f90
+
+program main
+
+    use myfcn
+    ! This module holds n, a, and provides function power(x)
+
+    implicit none
+    real(kind=8) :: x, x1, x2, y, tol
+    real(kind=8), external :: zeroin
+
+    print *, "Test routine for computing n'th root of a"
+    print *, "Input a "
+    read *, a
+    print *, "Input n "
+    read *, n
+    print *, "Input x1,x2:  interval containing zero"
+    read *, x1, x2
+
+    tol = 1.d-10  ! tolerance requested to zeroin
+
+    y = zeroin(x1, x2, power, tol)
+
+    print *, 'Estimated value: ', y
+    print *, 'Correct   value: ', a ** (1.d0/n)
+
+end program main

File codes/fortran/zeroin/zeroin.f

+c     $UWHPSC/codes/fortran/zeroin/zeroin.f
+c     This function came from Netlib:
+c        http://www.netlib.org/go/zeroin.f
+c     With some modification to remove dependence on d1mach
+c     by computing eps, the machine precision, in this routine.
+c
+c
+c     =================================================
+      function zeroin(ax,bx,f,tol)        
+c     =================================================
+      implicit double precision (a-h,o-z)
+      external f
+c  
+c      a zero of the function  f(x)  is computed in the interval ax,bx .
+c      (Standard routine from netlib)
+c  
+c  input..    
+c  
+c  ax     left endpoint of initial interval    
+c  bx     right endpoint of initial interval   
+c  f      function subprogram which evaluates f(x) for any x in      
+c         the interval  ax,bx       
+c  tol    desired length of the interval of uncertainty of the       
+c         final result ( .ge. 0.d0)  
+c  
+c  
+c  output..   
+c  
+c  zeroin abcissa approximating a zero of  f  in the interval ax,bx  
+c  
+c  
+c      it is assumed  that   f(ax)   and   f(bx)   have  opposite  signs
+c  without  a  check.  zeroin  returns a zero  x  in the given interval 
+c  ax,bx  to within a tolerance  4*macheps*dabs(x) + tol, where macheps 
+c  is the relative machine precision.          
+c
+c      this function subprogram is a slightly  modified  translation  of
+c  the algol 60 procedure  zero  given in  richard brent, algorithms for
+c  minimization without derivatives, prentice - hall, inc. (1973).   
+c  
+c  
+c  
+c  compute eps, the relative machine precision 
+c  
+      eps = 1.d0          
+   10 eps = eps/2.d0      
+      tol1 = 1.d0 + eps   
+      if (tol1 .gt. 1.d0) go to 10   
+c  
+c initialization         
+c  
+      a = ax  
+      b = bx  
+      fa = f(a)          
+      fb = f(b)          
+c  
+c begin step  
+c  
+   20 c = a   
+      fc = fa 
+      d = b - a          
+      e = d   
+   30 if (dabs(fc) .ge. dabs(fb)) go to 40       
+      a = b   
+      b = c   
+      c = a   
+      fa = fb 
+      fb = fc 
+      fc = fa 
+c  
+c convergence test       
+c  
+   40 tol1 = 2.d0*eps*dabs(b) + 0.5*tol          
+      xm = .5*(c - b)    
+      if (dabs(xm) .le. tol1) go to 90          
+      if (fb .eq. 0.d0) go to 90     
+c  
+c is bisection necessary 
+c  
+      if (dabs(e) .lt. tol1) go to 70
+      if (dabs(fa) .le. dabs(fb)) go to 70       
+c  
+c is quadratic interpolation possible          
+c  
+      if (a .ne. c) go to 50        
+c  
+c linear interpolation   
+c  
+      s = fb/fa          
+      p = 2.d0*xm*s       
+      q = 1.d0 - s        
+      go to 60
+c  
+c inverse quadratic interpolation   
+c  
+   50 q = fa/fc          
+      r = fb/fc          
+      s = fb/fa          
+      p = s*(2.d0*xm*q*(q - r) - (b - a)*(r - 1.d0))        
+      q = (q - 1.d0)*(r - 1.d0)*(s - 1.d0)        
+c  
+c adjust signs
+c  
+   60 if (p .gt. 0.d0) q = -q        
+      p = dabs(p)         
+c  
+c is interpolation acceptable       
+c  
+      if ((2.d0*p) .ge. (3.d0*xm*q - dabs(tol1*q))) go to 70 
+      if (p .ge. dabs(0.5*e*q)) go to 70        
+      e = d   
+      d = p/q 
+      go to 80
+c  
+c bisection   
+c  
+   70 d = xm  
+      e = d   
+c  
+c complete step          
+c  
+   80 a = b   
+      fa = fb 
+      if (dabs(d) .gt. tol1) b = b + d          
+      if (dabs(d) .le. tol1) b = b + dsign(tol1, xm)        
+      fb = f(b)          
+      if ((fb*(fc/dabs(fc))) .gt. 0.d0) go to 20 
+      go to 30
+c  
+c done        
+c  
+   90 zeroin = b         
+      return  
+      end     

File codes/homework5/Makefile

+
+OBJECTS = functions.o quadrature.o test.o
+FFLAGS = -fopenmp
+
+.PHONY: test clean 
+
+test: test.exe
+	./test.exe
+
+test.exe: $(OBJECTS)
+	gfortran $(FFLAGS) $(OBJECTS) -o test.exe
+
+%.o : %.f90
+	gfortran $(FFLAGS) -c  $< 
+
+clean:
+	rm -f *.o *.exe *.mod
+

File codes/homework5/README.txt

+
+Sample code to start with for Homework 5.
+
+For convenience a Makefile is provided:
+   $ make test
+
+to compile and run.
+
+A notebook describing Simpson's rule is in the notebook subdirectory, in
+various formats.
+

File codes/homework5/functions.f90

+
+module functions
+
+    use omp_lib
+    implicit none
+    integer :: fevals(0:7)
+    real(kind=8) :: k
+    save
+
+contains
+
+    real(kind=8) function f(x)
+        implicit none
+        real(kind=8), intent(in) :: x 
+        integer thread_num
+
+        ! keep track of number of function evaluations by
+        ! each thread:
+        thread_num = 0   ! serial mode
+        !$ thread_num = omp_get_thread_num()
+        fevals(thread_num) = fevals(thread_num) + 1
+        
+        f = 1.d0 + x**3 + sin(k*x)
+        
+    end function f
+
+end module functions

File codes/homework5/notebook/quadrature2.html

+<!DOCTYPE html>
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<meta charset="utf-8">
+<title>IPython Notebook</title>
+<link rel="stylesheet" href="quadrature2_files/jquery-ui.css" type="text/css">
+<link rel="stylesheet" href="quadrature2_files/boilerplate.css" type="text/css">
+<link rel="stylesheet" href="quadrature2_files/fbm.css" type="text/css">
+<link rel="stylesheet" href="quadrature2_files/page.css" type="text/css">
+
+
+<script type="text/javascript" src="quadrature2_files/MathJax.js" charset="utf-8"></script>
+
+<script type="text/javascript">
+// MathJax disabled, set as null to distingish from *missing* MathJax,
+// where it will be undefined, and should prompt a dialog later.
+window.mathjax_url = "http://cdn.mathjax.org/mathjax/latest/MathJax.js";
+</script>
+<link rel="stylesheet" href="quadrature2_files/codemirror.css">
+<link rel="stylesheet" href="quadrature2_files/ipython.css">
+<link rel="stylesheet" href="quadrature2_files/prettify.css">
+<link rel="stylesheet" href="quadrature2_files/notebook.css" type="text/css">
+<link rel="stylesheet" href="quadrature2_files/printnotebook.css" type="text/css">
+<link rel="stylesheet" href="quadrature2_files/renderedhtml.css" type="text/css">
+
+
+
+<style type="text/css">.MathJax_Hover_Frame {border-radius: .25em; -webkit-border-radius: .25em; -moz-border-radius: .25em; -khtml-border-radius: .25em; box-shadow: 0px 0px 15px #83A; -webkit-box-shadow: 0px 0px 15px #83A; -moz-box-shadow: 0px 0px 15px #83A; -khtml-box-shadow: 0px 0px 15px #83A; border: 1px solid #A6D ! important; display: inline-block; position: absolute}
+.MathJax_Hover_Arrow {position: absolute; width: 15px; height: 11px; cursor: pointer}
+</style><style type="text/css">#MathJax_About {position: fixed; left: 50%; width: auto; text-align: center; border: 3px outset; padding: 1em 2em; background-color: #DDDDDD; color: black; cursor: default; font-family: message-box; font-size: 120%; font-style: normal; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; border-radius: 15px; -webkit-border-radius: 15px; -moz-border-radius: 15px; -khtml-border-radius: 15px; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
+.MathJax_Menu {position: absolute; background-color: white; color: black; width: auto; padding: 5px 0px; border: 1px solid #CCCCCC; margin: 0; cursor: default; font: menu; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; -khtml-border-radius: 5px; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
+.MathJax_MenuItem {padding: 1px 2em; background: transparent}
+.MathJax_MenuTitle {background-color: #CCCCCC; margin: -5px 0 0 0; text-align: center; font-style: italic; font-size: 80%; color: #444444; padding: 2px 0; overflow: hidden}
+.MathJax_MenuArrow {position: absolute; right: .5em; color: #666666}
+.MathJax_MenuActive .MathJax_MenuArrow {color: white}
+.MathJax_MenuCheck {position: absolute; left: .7em}
+.MathJax_MenuRadioCheck {position: absolute; left: .7em}
+.MathJax_MenuLabel {padding: 1px 2em 3px 1.33em; font-style: italic}
+.MathJax_MenuRule {border-top: 1px solid #DDDDDD; margin: 4px 3px}
+.MathJax_MenuDisabled {color: GrayText}
+.MathJax_MenuActive {background-color: #606872; color: white}
+.MathJax_Menu_Close {position: absolute; width: 31px; height: 31px; top: -15px; left: -15px}
+</style><style type="text/css">#MathJax_Zoom {position: absolute; background-color: #F0F0F0; overflow: auto; display: block; z-index: 301; padding: .5em; border: 1px solid black; margin: 0; font-weight: normal; font-style: normal; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; box-shadow: 5px 5px 15px #AAAAAA; -webkit-box-shadow: 5px 5px 15px #AAAAAA; -moz-box-shadow: 5px 5px 15px #AAAAAA; -khtml-box-shadow: 5px 5px 15px #AAAAAA; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
+#MathJax_ZoomOverlay {position: absolute; left: 0; top: 0; z-index: 300; display: inline-block; width: 100%; height: 100%; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
+#MathJax_ZoomEventTrap {position: absolute; left: 0; top: 0; z-index: 302; display: inline-block; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
+</style><style type="text/css">.MathJax_Preview {color: #888}
+#MathJax_Message {position: fixed; left: 1px; bottom: 2px; background-color: #E6E6E6; border: 1px solid #959595; margin: 0px; padding: 2px 8px; z-index: 102; color: black; font-size: 80%; width: auto; white-space: nowrap}
+#MathJax_MSIE_Frame {position: absolute; top: 0; left: 0; width: 0px; z-index: 101; border: 0px; margin: 0px; padding: 0px}
+.MathJax_Error {color: #CC0000; font-style: italic}
+</style><style type="text/css">.MathJax_Display {text-align: center; margin: 0; position: relative; display: block; width: 100%}
+.MathJax .merror {background-color: #FFFF88; color: #CC0000; border: 1px solid #CC0000; padding: 1px 3px; font-style: normal; font-size: 90%}
+#MathJax_Tooltip {background-color: InfoBackground; color: InfoText; border: 1px solid black; box-shadow: 2px 2px 5px #AAAAAA; -webkit-box-shadow: 2px 2px 5px #AAAAAA; -moz-box-shadow: 2px 2px 5px #AAAAAA; -khtml-box-shadow: 2px 2px 5px #AAAAAA; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true'); padding: 3px 4px; position: absolute; left: 0; top: 0; width: auto; height: auto; display: none}
+.MathJax {display: inline; font-style: normal; font-weight: normal; line-height: normal; font-size: 100%; font-size-adjust: none; text-indent: 0; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; border: 0; padding: 0; margin: 0}
+.MathJax img, .MathJax nobr, .MathJax a {border: 0; padding: 0; margin: 0; max-width: none; max-height: none; vertical-align: 0; line-height: normal; text-decoration: none}
+img.MathJax_strut {border: 0 !important; padding: 0 !important; margin: 0 !important; vertical-align: 0 !important}
+.MathJax span {display: inline; position: static; border: 0; padding: 0; margin: 0; vertical-align: 0; line-height: normal; text-decoration: none}
+.MathJax nobr {white-space: nowrap ! important}
+.MathJax img {display: inline ! important; float: none ! important}
+.MathJax_Processing {visibility: hidden; position: fixed; width: 0; height: 0; overflow: hidden}
+.MathJax_Processed {display: none!important}
+.MathJax_ExBox {display: block; overflow: hidden; width: 1px; height: 60ex}
+.MathJax .MathJax_EmBox {display: block; overflow: hidden; width: 1px; height: 60em}
+.MathJax .MathJax_HitBox {cursor: text; background: white; opacity: 0; filter: alpha(opacity=0)}
+.MathJax .MathJax_HitBox * {filter: none; opacity: 1; background: transparent}
+#MathJax_Tooltip * {filter: none; opacity: 1; background: transparent}
+@font-face {font-family: MathJax_Blank; src: url('about:blank')}
+.MathJax .noError {vertical-align: ; font-size: 90%; text-align: left; color: black; padding: 1px 3px; border: 1px solid}
+</style></head>
+<body data-project="/Users/rjl/Dropbox/classes/am583.13/hw5" data-base-project-url="/" data-base-kernel-url="/" data-read-only="False" data-notebook-id="5b3b0c08-e36e-40c8-9f52-6459a8cd6248"><div style="visibility: hidden; overflow: hidden; position: absolute; top: 0px; height: 1px; width: auto; padding: 0px; border: 0px none; margin: 0px; text-align: left; text-indent: 0px; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal;"><div id="MathJax_Hidden"></div></div><div style="display: none;" id="MathJax_Message"></div>
+<div style="border-top-style: none; border-left-style: none; border-right-style: none;" class="border-box-sizing ui-widget ui-widget-content" id="header">
+<span id="ipython_notebook"><h1><a href="http://127.0.0.1:8888/" alt="dashboard"><img src="quadrature2_files/ipynblogo.png" alt="IPython Notebook"></a></h1></span>
+
+<span id="login_widget">
+
+</span>
+
+
+
+</div>
+<div style="display: block;" class="border-box-sizing" id="site">
+
+<div class="border-box-sizing ui-widget" id="main_app">
+<div class="border-box-sizing ui-widget" id="notebook_panel">
+<div class="border-box-sizing" id="notebook"><div tabindex="2" class="cell text_cell border-box-sizing ui-widget-content ui-corner-all"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><h1>Numerical Quadrature</h1></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>Numerical quadrature refers to approximating a definite integral numerically, 
+<span class="MathJax_Preview"></span><div style="text-align: left;" aria-readonly="true" role="textbox" class="MathJax_Display"><span style="" id="MathJax-Element-2-Frame" class="MathJax"><nobr><span style="margin-left: 0em;" id="MathJax-Span-6" class="math"><span style="display: inline-block; position: relative; width: 91px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(0.795em, 1000em, 3.667em, -0.524em); top: -2.564em; left: 0em;"><span id="MathJax-Span-7" class="mrow"><span style="font-family: STIXGeneral;" id="MathJax-Span-8" class="mtext">&nbsp;</span><span style="font-family: STIXGeneral;" id="MathJax-Span-9" class="mtext">&nbsp;</span><span style="padding-left: 0.188em;" id="MathJax-Span-10" class="msubsup"><span style="display: inline-block; position: relative; width: 1.659em; height: 0px;"><span style="position: absolute; clip: rect(2.112em, 1000em, 4.731em, -0.468em); top: -3.671em; left: 0em;"><span style="font-family: STIXIntegralsD; vertical-align: -0.615em;" id="MathJax-Span-11" class="mo">∫<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.45em;"></span></span><span style="display: inline-block; width: 0px; height: 3.671em;"></span></span><span style="position: absolute; clip: rect(1.673em, 1000em, 2.514em, -0.508em); top: -3.442em; left: 1.234em;"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-12" class="mi">b</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span><span style="position: absolute; clip: rect(1.844em, 1000em, 2.514em, -0.512em); top: -1.411em; left: 0.599em;"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-13" class="mi">a</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.188em;" id="MathJax-Span-14" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-15" class="mo">(</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-16" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-17" class="mo">)</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-18" class="mi">d<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.027em;"></span></span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-19" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-20" class="mo">.</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 3.166em; vertical-align: -1.183em;"></span></span></nobr></span></div><script id="MathJax-Element-2" type="math/tex; mode=display">~~ \int_a^b f(x) dx.</script>
+Many numerical analysis textbooks describe a variety of quadrature methods or "rules".  </p></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>First define a simple function for which we know the exact answer:</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[112]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 135.2px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-keyword">def</span> <span class="cm-variable">f1</span>(<span class="cm-variable">x</span>):</pre><pre>    <span class="cm-keyword">return</span> <span class="cm-number">1.</span> <span class="cm-operator">+</span> <span class="cm-variable">x</span><span class="cm-operator">**</span><span class="cm-number">3</span></pre><pre> </pre><pre><span class="cm-variable">a1</span> = <span class="cm-number">0.</span></pre><pre><span class="cm-variable">b1</span> = <span class="cm-number">2.</span></pre><pre><span class="cm-variable">int_true1</span> = (<span class="cm-variable">b1</span><span class="cm-operator">-</span><span class="cm-variable">a1</span>) <span class="cm-operator">+</span> (<span class="cm-variable">b1</span><span class="cm-operator">**</span><span class="cm-number">4</span> <span class="cm-operator">-</span><span class="cm-variable">a1</span><span class="cm-operator">**</span><span class="cm-number">4</span>) <span class="cm-operator">/</span> <span class="cm-number">4.</span></pre><pre><span class="cm-keyword">print</span> <span class="cm-string">"true integral: %22.14e"</span> <span class="cm-operator">%</span> <span class="cm-variable">int_true1</span></pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_text output_stream output_stdout"><pre>true integral:   6.00000000000000e+00
+</pre></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><h2>The Trapezoid Rule</h2></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>We will first look at the Trapezoid method.  This method is implemented by evaluating the function at <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-3-Frame" class="MathJax"><nobr><span id="MathJax-Span-21" class="math"><span style="display: inline-block; position: relative; width: 9px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.748em, -0.51em); top: -2.564em; left: 0em;"><span id="MathJax-Span-22" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-23" class="mi">n</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.68em; vertical-align: -0.081em;"></span></span></nobr></span><script id="MathJax-Element-3" type="math/tex">n</script>
+ points and then computing the areas of the trapezoids defined by a 
+piecewise linear approximation to the original function defined by these
+ points.  In the figure below, we are approximating the integral of the 
+blue curve by the sum of the areas of the red trapezoids.</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[113]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 188px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-keyword">def</span> <span class="cm-variable">plot_trap</span>(<span class="cm-variable">f</span>,<span class="cm-variable">a</span>,<span class="cm-variable">b</span>,<span class="cm-variable">n</span>):</pre><pre>    <span class="cm-variable">x</span> = <span class="cm-variable">linspace</span>(<span class="cm-variable">a</span><span class="cm-operator">-</span><span class="cm-number">0.2</span>, <span class="cm-variable">b</span><span class="cm-operator">+</span><span class="cm-number">0.2</span>, <span class="cm-number">10000</span>) <span class="cm-comment"># points for smooth plot</span></pre><pre>    <span class="cm-variable">plot</span>(<span class="cm-variable">x</span>,<span class="cm-variable">f</span>(<span class="cm-variable">x</span>),<span class="cm-string">'b-'</span>)</pre><pre>    <span class="cm-variable">xj</span> = <span class="cm-variable">linspace</span>(<span class="cm-variable">a</span>,<span class="cm-variable">b</span>,<span class="cm-variable">n</span>)</pre><pre>    <span class="cm-variable">plot</span>(<span class="cm-variable">xj</span>,<span class="cm-variable">f</span>(<span class="cm-variable">xj</span>),<span class="cm-string">'ro-'</span>)</pre><pre>    <span class="cm-keyword">for</span> <span class="cm-variable">xi</span> <span class="cm-operator">in</span> <span class="cm-variable">xj</span>:</pre><pre>        <span class="cm-variable">plot</span>([<span class="cm-variable">xi</span>,<span class="cm-variable">xi</span>], [<span class="cm-number">0</span>,<span class="cm-variable">f</span>(<span class="cm-variable">xi</span>)], <span class="cm-string">'r'</span>)</pre><pre>    <span class="cm-variable">plot</span>([<span class="cm-variable">a</span>,<span class="cm-variable">b</span>], [<span class="cm-number">0</span>,<span class="cm-number">0</span>], <span class="cm-string">'r'</span>) <span class="cm-comment"># along x-axis</span></pre><pre> </pre><pre><span class="cm-variable">plot_trap</span>(<span class="cm-variable">f1</span>,<span class="cm-variable">a1</span>,<span class="cm-variable">b1</span>,<span class="cm-number">5</span>)</pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_png"><div class="ui-wrapper ui-resizable-autohide" style="overflow: hidden; position: relative; width: 371px; height: 253px; top: 0px; left: 0px; margin: 0px;"><img style="resize: none; position: static; display: block; height: 253px; width: 371px;" class="ui-resizable" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXMAAAD9CAYAAABOd5eOAAA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ar18/AKpVq8aECRPo0qWLN77eJ1ydS//SSy8BMGrUKBITE0lLS6N58+ZERETw2muvmVy1+9wZ3wcf%0AfMALL7xASEgIMTExAXUztcGDB7N69WqOHDlC3bp1efjhh8nLywMCf9/BhccXyPtuzZo1vPnmm0Wn%0AMQM8/vjj/PTTT0Dg7z93xufJ/rM5A/WQt4iIFNGThkRELEBhLiJiAQpzERELUJiLiFiAwlxExAIU%0A5iIiFvD/InTd/hvGEDwAAAAASUVORK5CYII=%0A"><div style="display: none;" class="ui-resizable-handle ui-resizable-e"></div><div style="display: none;" class="ui-resizable-handle ui-resizable-s"></div><div style="z-index: 1001; display: none;" class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se"></div></div></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><h3>The Trapezoid rule formula</h3></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>The area of a single trapezoid is the width of the base times the average height, so between points <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-4-Frame" class="MathJax"><nobr><span id="MathJax-Span-24" class="math"><span style="display: inline-block; position: relative; width: 12px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.599em, 1000em, 2.686em, -0.551em); top: -2.214em; left: 0em;"><span id="MathJax-Span-25" class="mrow"><span id="MathJax-Span-26" class="msubsup"><span style="display: inline-block; position: relative; width: 0.713em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-27" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-28" class="mi">j<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.001em;"></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.214em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.025em; vertical-align: -0.426em;"></span></span></nobr></span><script id="MathJax-Element-4" type="math/tex">x_j</script> and <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-5-Frame" class="MathJax"><nobr><span id="MathJax-Span-29" class="math"><span style="display: inline-block; position: relative; width: 27px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.599em, 1000em, 2.686em, -0.551em); top: -2.214em; left: 0em;"><span id="MathJax-Span-30" class="mrow"><span id="MathJax-Span-31" class="msubsup"><span style="display: inline-block; position: relative; width: 1.587em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-32" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-33" class="texatom"><span id="MathJax-Span-34" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-35" class="mi">j<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.001em;"></span></span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-36" class="mo">+</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-37" class="mn">1</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.214em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.025em; vertical-align: -0.426em;"></span></span></nobr></span><script id="MathJax-Element-5" type="math/tex">x_{j+1}</script> this gives:
+<span class="MathJax_Preview"></span><div style="text-align: left;" aria-readonly="true" role="textbox" class="MathJax_Display"><span style="" id="MathJax-Element-6-Frame" class="MathJax"><nobr><span style="margin-left: 0em;" id="MathJax-Span-38" class="math"><span style="display: inline-block; position: relative; width: 126px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.03em, 1000em, 3.425em, -0.404em); top: -2.564em; left: 0em;"><span id="MathJax-Span-39" class="mrow"><span style="padding-left: 0.12em; padding-right: 0.12em;" id="MathJax-Span-40" class="mfrac"><span style="display: inline-block; position: relative; width: 0.644em; height: 0px;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -3.241em; left: 50%; margin-left: -0.262em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-41" class="mi">h</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; clip: rect(1.713em, 1000em, 2.739em, -0.495em); top: -1.878em; left: 50%; margin-left: -0.262em;"><span style="font-family: STIXGeneral;" id="MathJax-Span-42" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; clip: rect(0.801em, 1000em, 1.224em, -0.524em); top: -1.269em; left: 0em;"><span style="border-left: 0.644em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.25px; vertical-align: 0em;"></span><span style="display: inline-block; width: 0px; height: 1.049em;"></span></span></span></span><span style="font-family: STIXGeneral; padding-left: 0.188em;" id="MathJax-Span-43" class="mo">(</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-44" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-45" class="mo">(</span><span id="MathJax-Span-46" class="msubsup"><span style="display: inline-block; position: relative; width: 0.713em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-47" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-48" class="mi">j<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.001em;"></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-49" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-50" class="mo">+</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.25em;" id="MathJax-Span-51" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-52" class="mo">(</span><span id="MathJax-Span-53" class="msubsup"><span style="display: inline-block; position: relative; width: 1.587em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-54" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-55" class="texatom"><span id="MathJax-Span-56" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-57" class="mi">j<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.001em;"></span></span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-58" class="mo">+</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-59" class="mn">1</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-60" class="mo">)</span><span style="font-family: STIXGeneral;" id="MathJax-Span-61" class="mo">.</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 2.594em; vertical-align: -0.893em;"></span></span></nobr></span></div><script id="MathJax-Element-6" type="math/tex; mode=display"> \frac{h}{2} (f(x_j) + f(x_{j+1}). </script></p>
+
+<p>Summing this up over all the trapezoids gives:
+<span class="MathJax_Preview"></span><div style="text-align: left;" aria-readonly="true" role="textbox" class="MathJax_Display"><span style="" id="MathJax-Element-7-Frame" class="MathJax"><nobr><span style="margin-left: 0em;" id="MathJax-Span-62" class="math"><span style="display: inline-block; position: relative; width: 864px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(2.185em, 1000em, 5.709em, -0.505em); top: -4.138em; left: 0em;"><span id="MathJax-Span-63" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-64" class="mi">h</span><span id="MathJax-Span-65" class="mfenced"><span style="vertical-align: -0.586em;" id="MathJax-Span-66" class="mo"><span style="font-family: STIXSizeThreeSym;">(</span></span><span id="MathJax-Span-67" class="mrow"><span style="padding-left: 0.12em; padding-right: 0.12em;" id="MathJax-Span-68" class="mfrac"><span style="display: inline-block; position: relative; width: 0.644em; height: 0px;"><span style="position: absolute; clip: rect(1.713em, 1000em, 2.739em, -0.413em); top: -3.241em; left: 50%; margin-left: -0.262em;"><span style="font-family: STIXGeneral;" id="MathJax-Span-69" class="mn">1</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; clip: rect(1.713em, 1000em, 2.739em, -0.495em); top: -1.878em; left: 50%; margin-left: -0.262em;"><span style="font-family: STIXGeneral;" id="MathJax-Span-70" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; clip: rect(0.801em, 1000em, 1.224em, -0.524em); top: -1.269em; left: 0em;"><span style="border-left: 0.644em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.25px; vertical-align: 0em;"></span><span style="display: inline-block; width: 0px; height: 1.049em;"></span></span></span></span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.188em;" id="MathJax-Span-71" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-72" class="mo">(</span><span id="MathJax-Span-73" class="msubsup"><span style="display: inline-block; position: relative; width: 0.888em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-74" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-75" class="mn">0</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-76" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-77" class="mo">+</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.25em;" id="MathJax-Span-78" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-79" class="mo">(</span><span id="MathJax-Span-80" class="msubsup"><span style="display: inline-block; position: relative; width: 0.888em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-81" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-82" class="mn">1</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-83" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-84" class="mo">+</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.25em;" id="MathJax-Span-85" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-86" class="mo">(</span><span id="MathJax-Span-87" class="msubsup"><span style="display: inline-block; position: relative; width: 0.888em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-88" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-89" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-90" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-91" class="mo">+</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-92" class="mo">⋯</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-93" class="mo">+</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.25em;" id="MathJax-Span-94" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-95" class="mo">(</span><span id="MathJax-Span-96" class="msubsup"><span style="display: inline-block; position: relative; width: 1.704em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-97" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-98" class="texatom"><span id="MathJax-Span-99" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-100" class="mi">n</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-101" class="mo">−</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-102" class="mn">2</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-103" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-104" class="mo">+</span><span style="padding-left: 0.37em; padding-right: 0.12em;" id="MathJax-Span-105" class="mfrac"><span style="display: inline-block; position: relative; width: 0.644em; height: 0px;"><span style="position: absolute; clip: rect(1.713em, 1000em, 2.739em, -0.413em); top: -3.241em; left: 50%; margin-left: -0.262em;"><span style="font-family: STIXGeneral;" id="MathJax-Span-106" class="mn">1</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; clip: rect(1.713em, 1000em, 2.739em, -0.495em); top: -1.878em; left: 50%; margin-left: -0.262em;"><span style="font-family: STIXGeneral;" id="MathJax-Span-107" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; clip: rect(0.801em, 1000em, 1.224em, -0.524em); top: -1.269em; left: 0em;"><span style="border-left: 0.644em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.25px; vertical-align: 0em;"></span><span style="display: inline-block; width: 0px; height: 1.049em;"></span></span></span></span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.188em;" id="MathJax-Span-108" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-109" class="mo">(</span><span id="MathJax-Span-110" class="msubsup"><span style="display: inline-block; position: relative; width: 1.704em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-111" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-112" class="texatom"><span id="MathJax-Span-113" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-114" class="mi">n</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-115" class="mo">−</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-116" class="mn">1</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-117" class="mo">)</span></span><span style="vertical-align: -0.586em;" id="MathJax-Span-118" class="mo"><span style="font-family: STIXSizeThreeSym;">)</span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.48em; vertical-align: 0em;"></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.48em; vertical-align: 0em;"></span></span><span style="font-family: STIXGeneral; padding-left: 0.313em;" id="MathJax-Span-119" class="mo">=</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.313em;" id="MathJax-Span-120" class="mi">h</span><span style="padding-left: 0.188em;" id="MathJax-Span-121" class="munderover"><span style="display: inline-block; position: relative; width: 1.282em; height: 0px;"><span style="position: absolute; clip: rect(1.822em, 1000em, 3.622em, -0.434em); top: -2.972em; left: 0em;"><span style="font-family: STIXSizeOneSym; vertical-align: -0.524em;" id="MathJax-Span-122" class="mo">∑</span><span style="display: inline-block; width: 0px; height: 2.972em;"></span></span><span style="position: absolute; clip: rect(1.678em, 1000em, 2.752em, -0.612em); top: -1.181em; left: 0.117em;"><span id="MathJax-Span-123" class="texatom"><span id="MathJax-Span-124" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-125" class="mi">j<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.001em;"></span></span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-126" class="mo">=</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-127" class="mn">0</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span><span style="position: absolute; clip: rect(1.578em, 1000em, 2.512em, -0.515em); top: -3.531em; left: 0.058em;"><span id="MathJax-Span-128" class="texatom"><span id="MathJax-Span-129" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-130" class="mi">n</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-131" class="mo">−</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-132" class="mn">1</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.188em;" id="MathJax-Span-133" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-134" class="mo">(</span><span id="MathJax-Span-135" class="msubsup"><span style="display: inline-block; position: relative; width: 0.713em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-136" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-137" class="mi">j<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.001em;"></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-138" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-139" class="mo">−</span><span style="padding-left: 0.37em; padding-right: 0.12em;" id="MathJax-Span-140" class="mfrac"><span style="display: inline-block; position: relative; width: 0.644em; height: 0px;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -3.241em; left: 50%; margin-left: -0.262em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-141" class="mi">h</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; clip: rect(1.713em, 1000em, 2.739em, -0.495em); top: -1.878em; left: 50%; margin-left: -0.262em;"><span style="font-family: STIXGeneral;" id="MathJax-Span-142" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; clip: rect(0.801em, 1000em, 1.224em, -0.524em); top: -1.269em; left: 0em;"><span style="border-left: 0.644em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.25px; vertical-align: 0em;"></span><span style="display: inline-block; width: 0px; height: 1.049em;"></span></span></span></span><span style="padding-left: 0.188em;" id="MathJax-Span-143" class="mfenced"><span style="vertical-align: -0.201em;" id="MathJax-Span-144" class="mo"><span style="font-family: STIXSizeOneSym;">(</span></span><span id="MathJax-Span-145" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-146" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-147" class="mo">(</span><span id="MathJax-Span-148" class="msubsup"><span style="display: inline-block; position: relative; width: 0.888em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-149" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-150" class="mn">0</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-151" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-152" class="mo">+</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.25em;" id="MathJax-Span-153" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-154" class="mo">(</span><span id="MathJax-Span-155" class="msubsup"><span style="display: inline-block; position: relative; width: 1.704em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-156" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-157" class="texatom"><span id="MathJax-Span-158" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-159" class="mi">n</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-160" class="mo">−</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-161" class="mn">1</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-162" class="mo">)</span></span><span style="vertical-align: -0.201em;" id="MathJax-Span-163" class="mo"><span style="font-family: STIXSizeOneSym;">)</span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.865em; vertical-align: 0em;"></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.865em; vertical-align: 0em;"></span></span><span style="font-family: STIXGeneral; padding-left: 0.313em;" id="MathJax-Span-164" class="mo">=</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.313em;" id="MathJax-Span-165" class="mi">h</span><span style="padding-left: 0.188em;" id="MathJax-Span-166" class="munderover"><span style="display: inline-block; position: relative; width: 1.282em; height: 0px;"><span style="position: absolute; clip: rect(1.822em, 1000em, 3.622em, -0.434em); top: -2.972em; left: 0em;"><span style="font-family: STIXSizeOneSym; vertical-align: -0.524em;" id="MathJax-Span-167" class="mo">∑</span><span style="display: inline-block; width: 0px; height: 2.972em;"></span></span><span style="position: absolute; clip: rect(1.678em, 1000em, 2.752em, -0.612em); top: -1.181em; left: 0.117em;"><span id="MathJax-Span-168" class="texatom"><span id="MathJax-Span-169" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-170" class="mi">j<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.001em;"></span></span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-171" class="mo">=</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-172" class="mn">0</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span><span style="position: absolute; clip: rect(1.578em, 1000em, 2.512em, -0.515em); top: -3.531em; left: 0.058em;"><span id="MathJax-Span-173" class="texatom"><span id="MathJax-Span-174" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-175" class="mi">n</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-176" class="mo">−</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-177" class="mn">1</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.188em;" id="MathJax-Span-178" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-179" class="mo">(</span><span id="MathJax-Span-180" class="msubsup"><span style="display: inline-block; position: relative; width: 0.713em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-181" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-182" class="mi">j<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.001em;"></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-183" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-184" class="mo">−</span><span style="padding-left: 0.37em; padding-right: 0.12em;" id="MathJax-Span-185" class="mfrac"><span style="display: inline-block; position: relative; width: 0.644em; height: 0px;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -3.241em; left: 50%; margin-left: -0.262em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-186" class="mi">h</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; clip: rect(1.713em, 1000em, 2.739em, -0.495em); top: -1.878em; left: 50%; margin-left: -0.262em;"><span style="font-family: STIXGeneral;" id="MathJax-Span-187" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; clip: rect(0.801em, 1000em, 1.224em, -0.524em); top: -1.269em; left: 0em;"><span style="border-left: 0.644em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.25px; vertical-align: 0em;"></span><span style="display: inline-block; width: 0px; height: 1.049em;"></span></span></span></span><span style="padding-left: 0.188em;" id="MathJax-Span-188" class="mfenced"><span style="vertical-align: -0.201em;" id="MathJax-Span-189" class="mo"><span style="font-family: STIXSizeOneSym;">(</span></span><span id="MathJax-Span-190" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-191" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-192" class="mo">(</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-193" class="mi">a</span><span style="font-family: STIXGeneral;" id="MathJax-Span-194" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-195" class="mo">+</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.25em;" id="MathJax-Span-196" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-197" class="mo">(</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-198" class="mi">b</span><span style="font-family: STIXGeneral;" id="MathJax-Span-199" class="mo">)</span><span style="font-family: STIXGeneral;" id="MathJax-Span-200" class="mo">)</span></span><span style="vertical-align: -0.201em;" id="MathJax-Span-201" class="mo"><span style="font-family: STIXSizeOneSym;">)</span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.865em; vertical-align: 0em;"></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.865em; vertical-align: 0em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-202" class="mo">.</span></span><span style="display: inline-block; width: 0px; height: 4.138em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 3.949em; vertical-align: -1.746em;"></span></span></nobr></span></div><script id="MathJax-Element-7" type="math/tex; mode=display"> h\left(\frac 1 2 f(x_0) + f(x_1) + f(x_2) + \cdots + f(x_{n-2}) + \frac 1 2 f(x_{n-1})\right) = h\sum_{j=0}^{n-1} f(x_j) - \frac h 2 \left(f(x_0) + f(x_{n-1})\right) =  h\sum_{j=0}^{n-1} f(x_j) - \frac h 2 \left(f(a) + f(b))\right). </script></p>
+
+<p>This can be implemented as follows (note that in Python fj[-1] refers
+ to the last element of fj, and similarly fj[-2] would be the next to 
+last element).</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[114]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71661px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 135.2px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-keyword">def</span> <span class="cm-variable">trapezoid</span>(<span class="cm-variable">f</span>,<span class="cm-variable">a</span>,<span class="cm-variable">b</span>,<span class="cm-variable">n</span>):</pre><pre>    <span class="cm-variable">h</span> = (<span class="cm-variable">b</span><span class="cm-operator">-</span><span class="cm-variable">a</span>)<span class="cm-operator">/</span>(<span class="cm-variable">n</span><span class="cm-operator">-</span><span class="cm-number">1</span>)</pre><pre>    <span class="cm-variable">xj</span> = <span class="cm-variable">linspace</span>(<span class="cm-variable">a</span>,<span class="cm-variable">b</span>,<span class="cm-variable">n</span>)</pre><pre>    <span class="cm-variable">fj</span> = <span class="cm-variable">f</span>(<span class="cm-variable">xj</span>)</pre><pre>    <span class="cm-variable">int_trapezoid</span> = <span class="cm-variable">h</span><span class="cm-operator">*</span><span class="cm-builtin">sum</span>(<span class="cm-variable">fj</span>) <span class="cm-operator">-</span> <span class="cm-number">0.5</span><span class="cm-operator">*</span><span class="cm-variable">h</span><span class="cm-operator">*</span>(<span class="cm-variable">fj</span>[<span class="cm-number">0</span>] <span class="cm-operator">+</span> <span class="cm-variable">fj</span>[<span class="cm-operator">-</span><span class="cm-number">1</span>])</pre><pre>    <span class="cm-keyword">return</span> <span class="cm-variable">int_trapezoid</span></pre><pre> </pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>We can test it out for the points used in the figure above:</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[115]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 82.4px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-variable">n</span> = <span class="cm-number">5</span></pre><pre><span class="cm-variable">int_trap</span> = <span class="cm-variable">trapezoid</span>(<span class="cm-variable">f1</span>,<span class="cm-variable">a1</span>,<span class="cm-variable">b1</span>,<span class="cm-variable">n</span>)</pre><pre><span class="cm-variable">error</span> = <span class="cm-builtin">abs</span>(<span class="cm-variable">int_trap</span> <span class="cm-operator">-</span> <span class="cm-variable">int_true1</span>)</pre><pre><span class="cm-keyword">print</span> <span class="cm-string">"trapezoid rule approximation: %22.14e,  error: %10.3e"</span> <span class="cm-operator">%</span> (<span class="cm-variable">int_trap</span>, <span class="cm-variable">error</span>)</pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_text output_stream output_stdout"><pre>trapezoid rule approximation:   6.25000000000000e+00,  error:  2.500e-01
+</pre></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>Using more points will give a better approximation, try changing it in the cell above.</p></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><h3>Convergence tests</h3></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>If
+ we increase n, the number of points used, and hence decrease h, the 
+spacing between points, we expect the error to converge to zero for 
+reasonable functions <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-8-Frame" class="MathJax"><nobr><span id="MathJax-Span-203" class="math"><span style="display: inline-block; position: relative; width: 26px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.711em, 1000em, 2.946em, -0.671em); top: -2.564em; left: 0em;"><span id="MathJax-Span-204" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-205" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-206" class="mo">(</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-207" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-208" class="mo">)</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.202em; vertical-align: -0.318em;"></span></span></nobr></span><script id="MathJax-Element-8" type="math/tex">f(x)</script>.</p>
+
+<p>The trapezoid rule is "second order accurate", meaning that the error goes to zero like <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-9-Frame" class="MathJax"><nobr><span id="MathJax-Span-209" class="math"><span style="display: inline-block; position: relative; width: 40px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.501em, 1000em, 2.916em, -0.464em); top: -2.564em; left: 0em;"><span id="MathJax-Span-210" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-211" class="mi">O</span><span style="font-family: STIXGeneral;" id="MathJax-Span-212" class="mo">(</span><span id="MathJax-Span-213" class="msubsup"><span style="display: inline-block; position: relative; width: 0.949em; height: 0px;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-214" class="mi">h</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.741em; left: 0.524em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-215" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-216" class="mo">)</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.418em; vertical-align: -0.282em;"></span></span></nobr></span><script id="MathJax-Element-9" type="math/tex">O(h^2)</script> for a function that is sufficiently smooth (for example if its second derivative is continuous).  For small <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-10-Frame" class="MathJax"><nobr><span id="MathJax-Span-217" class="math"><span style="display: inline-block; position: relative; width: 9px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -2.564em; left: 0em;"><span id="MathJax-Span-218" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-219" class="mi">h</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.97em; vertical-align: -0.081em;"></span></span></nobr></span><script id="MathJax-Element-10" type="math/tex">h</script>, the error is expected to be behave like <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-11-Frame" class="MathJax"><nobr><span id="MathJax-Span-220" class="math"><span style="display: inline-block; position: relative; width: 93px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.501em, 1000em, 2.916em, -0.458em); top: -2.564em; left: 0em;"><span id="MathJax-Span-221" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-222" class="mi">C<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.022em;"></span></span><span id="MathJax-Span-223" class="msubsup"><span style="display: inline-block; position: relative; width: 0.949em; height: 0px;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-224" class="mi">h</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.741em; left: 0.524em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-225" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-226" class="mo">+</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.25em;" id="MathJax-Span-227" class="mi">O</span><span style="font-family: STIXGeneral;" id="MathJax-Span-228" class="mo">(</span><span id="MathJax-Span-229" class="msubsup"><span style="display: inline-block; position: relative; width: 0.949em; height: 0px;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-230" class="mi">h</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.741em; left: 0.524em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-231" class="mn">3</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-232" class="mo">)</span><span style="font-family: STIXGeneral;" id="MathJax-Span-233" class="mtext">&nbsp;</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.418em; vertical-align: -0.282em;"></span></span></nobr></span><script id="MathJax-Element-11" type="math/tex">Ch^2 + O(h^3)~</script> as <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-12-Frame" class="MathJax"><nobr><span id="MathJax-Span-234" class="math"><span style="display: inline-block; position: relative; width: 9px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -2.564em; left: 0em;"><span id="MathJax-Span-235" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-236" class="mi">h</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.97em; vertical-align: -0.081em;"></span></span></nobr></span><script id="MathJax-Element-12" type="math/tex">h</script> goes to zero, where <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-13-Frame" class="MathJax"><nobr><span id="MathJax-Span-237" class="math"><span style="display: inline-block; position: relative; width: 12px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.723em, 1000em, 2.757em, -0.458em); top: -2.564em; left: 0em;"><span id="MathJax-Span-238" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-239" class="mi">C<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.022em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.961em; vertical-align: -0.092em;"></span></span></nobr></span><script id="MathJax-Element-13" type="math/tex">C</script> is some constant that depends on how smooth <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-14-Frame" class="MathJax"><nobr><span id="MathJax-Span-240" class="math"><span style="display: inline-block; position: relative; width: 9px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -2.564em; left: 0em;"><span id="MathJax-Span-241" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-242" class="mi">h</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.97em; vertical-align: -0.081em;"></span></span></nobr></span><script id="MathJax-Element-14" type="math/tex">h</script> is.  </p>
+
+<p>If we double n (and halve h) then we expect the error to go down by a factor of 4 roughly (from <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-15-Frame" class="MathJax"><nobr><span id="MathJax-Span-243" class="math"><span style="display: inline-block; position: relative; width: 28px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.501em, 1000em, 2.757em, -0.458em); top: -2.564em; left: 0em;"><span id="MathJax-Span-244" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-245" class="mi">C<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.022em;"></span></span><span id="MathJax-Span-246" class="msubsup"><span style="display: inline-block; position: relative; width: 0.949em; height: 0px;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-247" class="mi">h</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.741em; left: 0.524em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-248" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.227em; vertical-align: -0.092em;"></span></span></nobr></span><script id="MathJax-Element-15" type="math/tex">Ch^2</script> to <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-16-Frame" class="MathJax"><nobr><span id="MathJax-Span-249" class="math"><span style="display: inline-block; position: relative; width: 57px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.508em, 1000em, 2.916em, -0.458em); top: -2.564em; left: 0em;"><span id="MathJax-Span-250" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-251" class="mi">C<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.022em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-252" class="mo">(</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-253" class="mi">h</span><span id="MathJax-Span-254" class="texatom"><span id="MathJax-Span-255" class="mrow"><span style="font-family: STIXGeneral;" id="MathJax-Span-256" class="mo">/</span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-257" class="mn">2</span><span id="MathJax-Span-258" class="msubsup"><span style="display: inline-block; position: relative; width: 0.774em; height: 0px;"><span style="position: absolute; clip: rect(1.713em, 1000em, 2.916em, -0.495em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral;" id="MathJax-Span-259" class="mo">)</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.734em; left: 0.35em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-260" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-261" class="mtext">&nbsp;</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.409em; vertical-align: -0.282em;"></span></span></nobr></span><script id="MathJax-Element-16" type="math/tex">C(h/2)^2~</script>).</p>
+
+<p>We can check this by trying several values of n and making a table of the errors and the ratio from one n to the next:</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[116]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 293.6px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-keyword">def</span> <span class="cm-variable">error_table</span>(<span class="cm-variable">f</span>,<span class="cm-variable">a</span>,<span class="cm-variable">b</span>,<span class="cm-variable">nvals</span>,<span class="cm-variable">int_true</span>,<span class="cm-variable">method</span>=<span class="cm-variable">trapezoid</span>):</pre><pre>    <span class="cm-string">"""</span></pre><pre><span class="cm-string">    An improved version that takes the function defining the method as an</span></pre><pre><span class="cm-string">    input argument.</span></pre><pre><span class="cm-string">    """</span></pre><pre>    <span class="cm-keyword">print</span> <span class="cm-string">"      n         approximation        error       ratio"</span></pre><pre>    <span class="cm-variable">last_error</span> = <span class="cm-number">0.</span>  <span class="cm-comment"># need something for first ratio</span></pre><pre>    <span class="cm-keyword">for</span> <span class="cm-variable">n</span> <span class="cm-operator">in</span> <span class="cm-variable">nvals</span>:</pre><pre>        <span class="cm-variable">int_approx</span> = <span class="cm-variable">method</span>(<span class="cm-variable">f</span>,<span class="cm-variable">a</span>,<span class="cm-variable">b</span>,<span class="cm-variable">n</span>)</pre><pre>        <span class="cm-variable">error</span> = <span class="cm-builtin">abs</span>(<span class="cm-variable">int_approx</span> <span class="cm-operator">-</span> <span class="cm-variable">int_true</span>)</pre><pre>        <span class="cm-variable">ratio</span> = <span class="cm-variable">last_error</span> <span class="cm-operator">/</span> <span class="cm-variable">error</span></pre><pre>        <span class="cm-variable">last_error</span> = <span class="cm-variable">error</span> <span class="cm-comment"># for next n</span></pre><pre>        <span class="cm-keyword">print</span> <span class="cm-string">"%8i  %22.14e  %10.3e  %10.3e"</span> <span class="cm-operator">%</span> (<span class="cm-variable">n</span>,<span class="cm-variable">int_approx</span>, <span class="cm-variable">error</span>, <span class="cm-variable">ratio</span>)</pre><pre>    </pre><pre><span class="cm-variable">nvals</span> = <span class="cm-variable">array</span>([<span class="cm-number">5</span>, <span class="cm-number">10</span>, <span class="cm-number">20</span>, <span class="cm-number">40</span>, <span class="cm-number">80</span>, <span class="cm-number">160</span>, <span class="cm-number">320</span>])</pre><pre><span class="cm-variable">error_table</span>(<span class="cm-variable">f1</span>,<span class="cm-variable">a1</span>,<span class="cm-variable">b1</span>,<span class="cm-variable">nvals</span>,<span class="cm-variable">int_true1</span>,<span class="cm-variable">trapezoid</span>)</pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_text output_stream output_stdout"><pre>      n         approximation        error       ratio
+       5    6.25000000000000e+00   2.500e-01   0.000e+00
+      10    6.04938271604938e+00   4.938e-02   5.062e+00
+      20    6.01108033240997e+00   1.108e-02   4.457e+00
+      40    6.00262984878369e+00   2.630e-03   4.213e+00
+      80    6.00064092292902e+00   6.409e-04   4.103e+00
+     160    6.00015822158934e+00   1.582e-04   4.051e+00
+     320    6.00003930778982e+00   3.931e-05   4.025e+00
+</pre></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>(Note that the first ratio reported is meaningless.)</p>
+
+<p>Convergence might be easier to see in a plot.  If a method is p'th order accurate then we expect the error to behave like <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-17-Frame" class="MathJax"><nobr><span id="MathJax-Span-262" class="math"><span style="display: inline-block; position: relative; width: 62px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.667em, 1000em, 2.757em, -0.525em); top: -2.564em; left: 0em;"><span id="MathJax-Span-263" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-264" class="mi">E<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.023em;"></span></span><span style="font-family: STIXGeneral; padding-left: 0.313em;" id="MathJax-Span-265" class="mo">≈</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.313em;" id="MathJax-Span-266" class="mi">C<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.022em;"></span></span><span id="MathJax-Span-267" class="msubsup"><span style="display: inline-block; position: relative; width: 0.949em; height: 0px;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-268" class="mi">h</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.741em; left: 0.524em;"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-269" class="mi">p</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.028em; vertical-align: -0.092em;"></span></span></nobr></span><script id="MathJax-Element-17" type="math/tex">E\approx Ch^p</script> for some constant <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-18-Frame" class="MathJax"><nobr><span id="MathJax-Span-270" class="math"><span style="display: inline-block; position: relative; width: 12px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.723em, 1000em, 2.757em, -0.458em); top: -2.564em; left: 0em;"><span id="MathJax-Span-271" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-272" class="mi">C<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.022em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.961em; vertical-align: -0.092em;"></span></span></nobr></span><script id="MathJax-Element-18" type="math/tex">C</script>, for small <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-19-Frame" class="MathJax"><nobr><span id="MathJax-Span-273" class="math"><span style="display: inline-block; position: relative; width: 9px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -2.564em; left: 0em;"><span id="MathJax-Span-274" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-275" class="mi">h</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.97em; vertical-align: -0.081em;"></span></span></nobr></span><script id="MathJax-Element-19" type="math/tex">h</script>.
+  This is hard to visualize.  It is much easier to see what order 
+accuracy we are achieving if we produce a log-log plot instead, since <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-20-Frame" class="MathJax"><nobr><span id="MathJax-Span-276" class="math"><span style="display: inline-block; position: relative; width: 66px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.667em, 1000em, 2.757em, -0.525em); top: -2.564em; left: 0em;"><span id="MathJax-Span-277" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-278" class="mi">E<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.023em;"></span></span><span style="font-family: STIXGeneral; padding-left: 0.313em;" id="MathJax-Span-279" class="mo">=</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.313em;" id="MathJax-Span-280" class="mi">C<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.022em;"></span></span><span id="MathJax-Span-281" class="msubsup"><span style="display: inline-block; position: relative; width: 0.949em; height: 0px;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-282" class="mi">h</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.741em; left: 0.524em;"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-283" class="mi">p</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-284" class="mtext">&nbsp;</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.028em; vertical-align: -0.092em;"></span></span></nobr></span><script id="MathJax-Element-20" type="math/tex">E = Ch^p~</script> means that <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-21-Frame" class="MathJax"><nobr><span id="MathJax-Span-285" class="math"><span style="display: inline-block; position: relative; width: 162px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.957em, -0.505em); top: -2.564em; left: 0em;"><span id="MathJax-Span-286" class="mrow"><span style="font-family: STIXGeneral;" id="MathJax-Span-287" class="mi">log</span><span id="MathJax-Span-288" class="mo"></span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.188em;" id="MathJax-Span-289" class="mi">E<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.023em;"></span></span><span style="font-family: STIXGeneral; padding-left: 0.313em;" id="MathJax-Span-290" class="mo">=</span><span style="font-family: STIXGeneral; padding-left: 0.313em;" id="MathJax-Span-291" class="mi">log</span><span id="MathJax-Span-292" class="mo"></span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.188em;" id="MathJax-Span-293" class="mi">C<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.022em;"></span></span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-294" class="mo">+</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.25em;" id="MathJax-Span-295" class="mi">p</span><span style="font-family: STIXGeneral; padding-left: 0.188em;" id="MathJax-Span-296" class="mi">log</span><span id="MathJax-Span-297" class="mo"></span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.188em;" id="MathJax-Span-298" class="mi">h</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.221em; vertical-align: -0.332em;"></span></span></nobr></span><script id="MathJax-Element-21" type="math/tex">\log E = \log C + p\log h</script> </p>
+
+<p>In other words <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-22-Frame" class="MathJax"><nobr><span id="MathJax-Span-299" class="math"><span style="display: inline-block; position: relative; width: 40px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.957em, -0.505em); top: -2.564em; left: 0em;"><span id="MathJax-Span-300" class="mrow"><span style="font-family: STIXGeneral;" id="MathJax-Span-301" class="mi">log</span><span id="MathJax-Span-302" class="mo"></span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.188em;" id="MathJax-Span-303" class="mi">E<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.023em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-304" class="mtext">&nbsp;</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.221em; vertical-align: -0.332em;"></span></span></nobr></span><script id="MathJax-Element-22" type="math/tex">\log E~</script> is a linear function of <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-23-Frame" class="MathJax"><nobr><span id="MathJax-Span-305" class="math"><span style="display: inline-block; position: relative; width: 38px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.957em, -0.505em); top: -2.564em; left: 0em;"><span id="MathJax-Span-306" class="mrow"><span style="font-family: STIXGeneral;" id="MathJax-Span-307" class="mi">log</span><span id="MathJax-Span-308" class="mo"></span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.188em;" id="MathJax-Span-309" class="mi">h</span><span style="font-family: STIXGeneral;" id="MathJax-Span-310" class="mtext">&nbsp;</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.221em; vertical-align: -0.332em;"></span></span></nobr></span><script id="MathJax-Element-23" type="math/tex">\log h~</script>.</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[117]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 240.8px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-keyword">def</span> <span class="cm-variable">error_plot</span>(<span class="cm-variable">f</span>,<span class="cm-variable">a</span>,<span class="cm-variable">b</span>,<span class="cm-variable">nvals</span>,<span class="cm-variable">int_true</span>,<span class="cm-variable">method</span>=<span class="cm-variable">trapezoid</span>):</pre><pre>    <span class="cm-variable">errvals</span> = <span class="cm-variable">zeros</span>(<span class="cm-variable">nvals.shape</span>)  <span class="cm-comment"># initialize to right shape</span></pre><pre>    <span class="cm-keyword">for</span> <span class="cm-variable">i</span> <span class="cm-operator">in</span> <span class="cm-builtin">range</span>(<span class="cm-builtin">len</span>(<span class="cm-variable">nvals</span>)):</pre><pre>        <span class="cm-variable">n</span> = <span class="cm-variable">nvals</span>[<span class="cm-variable">i</span>]</pre><pre>        <span class="cm-variable">int_approx</span> = <span class="cm-variable">method</span>(<span class="cm-variable">f</span>,<span class="cm-variable">a</span>,<span class="cm-variable">b</span>,<span class="cm-variable">n</span>)</pre><pre>        <span class="cm-variable">error</span> = <span class="cm-builtin">abs</span>(<span class="cm-variable">int_approx</span> <span class="cm-operator">-</span> <span class="cm-variable">int_true</span>)</pre><pre>        <span class="cm-variable">errvals</span>[<span class="cm-variable">i</span>] = <span class="cm-variable">error</span></pre><pre>    <span class="cm-variable">hvals</span> = (<span class="cm-variable">b</span> <span class="cm-operator">-</span> <span class="cm-variable">a</span>) <span class="cm-operator">/</span> (<span class="cm-variable">nvals</span> <span class="cm-operator">-</span> <span class="cm-number">1</span>)  <span class="cm-comment"># vector of h values for each n</span></pre><pre>    <span class="cm-variable">loglog</span>(<span class="cm-variable">hvals</span>,<span class="cm-variable">errvals</span>, <span class="cm-string">'o-'</span>)</pre><pre>    <span class="cm-variable">xlabel</span>(<span class="cm-string">'spacing h'</span>)</pre><pre>    <span class="cm-variable">ylabel</span>(<span class="cm-string">'error'</span>)</pre><pre>    </pre><pre><span class="cm-variable">error_plot</span>(<span class="cm-variable">f1</span>,<span class="cm-variable">a1</span>,<span class="cm-variable">b1</span>,<span class="cm-variable">nvals</span>,<span class="cm-variable">int_true1</span>,<span class="cm-variable">trapezoid</span>)</pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_png"><div class="ui-wrapper ui-resizable-autohide" style="overflow: hidden; position: relative; width: 394px; height: 278px; top: 0px; left: 0px; margin: 0px;"><img style="resize: none; position: static; display: block; height: 278px; width: 394px;" class="ui-resizable" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYoAAAEWCAYAAAB42tAoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz%0AAAALEgAACxIB0t1+/AAAHf9JREFUeJzt3X9wVOW9x/FPQkpQ0Cq9iiXJNJL0YqiJEH60Mk0IYyFq%0ABixYMJkparZFsJgE2kGBwCWIjOI445B0BFsBf9RmGL3R4OwVAjLJ2vAjBYSGGgUjOxNDp7RSEfmx%0AMeHcP1LSRJJNsjl79pzd92smM+yzu+d84bD7zfN8z/M8UYZhGAIAoAfRoQ4AAGBvJAoAgF8kCgCA%0AXyQKAIBfJAoAgF8kCgCAXyQKAIBfJAoAgF8xoQ5Aknw+n5YvX66LFy/qvvvu09133x3qkAAA/2aL%0AHkVtba0mTpyojRs3qqKiItThAAA6CVqicLlcGjFihFJTU7u0ezwepaenKy0tTWVlZZKk+vp6JSUl%0ASZIuXrwYrJAAAAEIWqLIz8/Xjh07urS1tbXJ5XKpoqJChw4d0ubNm9XQ0KC0tDR9+umnkqRrr702%0AWCEBAAIQtBpFRkaGvF5vl7a6ujolJycrMTFRkpSbm6vKykotWbJExcXFqq2t1ezZs3s8ZlRUVLDC%0ABYCwNdC1Xy2tUTQ3NyshIaHjcXx8vJqbmxUbG6vnnntOZWVlys7O9nsMwzBC+rN69WpbHK8/7+vt%0AtYE+3592s//d7HD97HDtentNIM/Z9fqF42fP7OvXXZsZLE0UZvQISkpKVF1dPfBgApSVlWWL4/Xn%0Afb29NtDn+9tuB2bGZodr19trAnnOrtcv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8owjI7iOWBX9CgQ8az8bd3t%0AdmvcuHEaNWqUTpw4oZUrV1p2biBQ9CgAAH7RowAA+EWiAAD4RaIAAPhFogAA+EWiAAD4RaIAAPj1%0A/zfgh3ptRGDvAAAAAElFTkSuQmCC%0A"><div style="display: none;" class="ui-resizable-handle ui-resizable-e"></div><div style="display: none;" class="ui-resizable-handle ui-resizable-s"></div><div style="z-index: 1001; display: none;" class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se"></div></div></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><h3>An oscillatory function</h3></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>If the function <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-24-Frame" class="MathJax"><nobr><span id="MathJax-Span-311" class="math"><span style="display: inline-block; position: relative; width: 26px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.711em, 1000em, 2.946em, -0.671em); top: -2.564em; left: 0em;"><span id="MathJax-Span-312" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-313" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-314" class="mo">(</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-315" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-316" class="mo">)</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.202em; vertical-align: -0.318em;"></span></span></nobr></span><script id="MathJax-Element-24" type="math/tex">f(x)</script>
+ is not as smooth (has larger second derivative at various places) then 
+the accuracy with a small number of points will not be nearly as good.  
+For example, consider the function <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-25-Frame" class="MathJax"><nobr><span id="MathJax-Span-317" class="math"><span style="display: inline-block; position: relative; width: 179px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.548em, 1000em, 2.981em, -0.671em); top: -2.564em; left: 0em;"><span id="MathJax-Span-318" class="mrow"><span id="MathJax-Span-319" class="msubsup"><span style="display: inline-block; position: relative; width: 0.687em; height: 0px;"><span style="position: absolute; clip: rect(1.711em, 1000em, 2.946em, -0.671em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-320" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.089em; left: 0.262em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-321" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-322" class="mo">(</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-323" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-324" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.313em;" id="MathJax-Span-325" class="mo">=</span><span style="font-family: STIXGeneral; padding-left: 0.313em;" id="MathJax-Span-326" class="mn">1</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-327" class="mo">+</span><span style="padding-left: 0.25em;" id="MathJax-Span-328" class="msubsup"><span style="display: inline-block; position: relative; width: 0.942em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-329" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.694em; left: 0.517em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-330" class="mn">3</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-331" class="mo">+</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-332" class="mi">sin</span><span id="MathJax-Span-333" class="mo"></span><span style="font-family: STIXGeneral;" id="MathJax-Span-334" class="mo">(</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-335" class="mi">k<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.017em;"></span></span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-336" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-337" class="mo">)</span><span style="font-family: STIXGeneral;" id="MathJax-Span-338" class="mtext">&nbsp;</span><span style="font-family: STIXGeneral;" id="MathJax-Span-339" class="mtext">&nbsp;</span><span style="font-family: STIXGeneral;" id="MathJax-Span-340" class="mtext">&nbsp;</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.44em; vertical-align: -0.361em;"></span></span></nobr></span><script id="MathJax-Element-25" type="math/tex">f_2(x) = 1 + x^3 + \sin(kx)~~~</script> where <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-26-Frame" class="MathJax"><nobr><span id="MathJax-Span-341" class="math"><span style="display: inline-block; position: relative; width: 8px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.75em, -0.51em); top: -2.564em; left: 0em;"><span id="MathJax-Span-342" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-343" class="mi">k<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.017em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.973em; vertical-align: -0.083em;"></span></span></nobr></span><script id="MathJax-Element-26" type="math/tex">k</script> is a parameter.  For large <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-27-Frame" class="MathJax"><nobr><span id="MathJax-Span-344" class="math"><span style="display: inline-block; position: relative; width: 8px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.75em, -0.51em); top: -2.564em; left: 0em;"><span id="MathJax-Span-345" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-346" class="mi">k<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.017em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.973em; vertical-align: -0.083em;"></span></span></nobr></span><script id="MathJax-Element-27" type="math/tex">k</script> this function is very oscillatory.  In order to experiment with different values of <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-28-Frame" class="MathJax"><nobr><span id="MathJax-Span-347" class="math"><span style="display: inline-block; position: relative; width: 8px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.75em, -0.51em); top: -2.564em; left: 0em;"><span id="MathJax-Span-348" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-349" class="mi">k<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.017em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.973em; vertical-align: -0.083em;"></span></span></nobr></span><script id="MathJax-Element-28" type="math/tex">k</script>, we can define a "function factory" that creates this function for any given <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-29-Frame" class="MathJax"><nobr><span id="MathJax-Span-350" class="math"><span style="display: inline-block; position: relative; width: 8px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.75em, -0.51em); top: -2.564em; left: 0em;"><span id="MathJax-Span-351" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-352" class="mi">k<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.017em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.973em; vertical-align: -0.083em;"></span></span></nobr></span><script id="MathJax-Element-29" type="math/tex">k</script>, and also returns the true integral over a given interval:</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[118]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71661px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 117.6px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-keyword">def</span> <span class="cm-variable">f2_factory</span>(<span class="cm-variable">k</span>, <span class="cm-variable">a</span>, <span class="cm-variable">b</span>):</pre><pre>    <span class="cm-keyword">def</span> <span class="cm-variable">f2</span>(<span class="cm-variable">x</span>):</pre><pre>        <span class="cm-keyword">return</span> <span class="cm-number">1</span> <span class="cm-operator">+</span> <span class="cm-variable">x</span><span class="cm-operator">**</span><span class="cm-number">3</span> <span class="cm-operator">+</span> <span class="cm-variable">sin</span>(<span class="cm-variable">k</span><span class="cm-operator">*</span><span class="cm-variable">x</span>)</pre><pre>    <span class="cm-variable">int_true</span> = (<span class="cm-variable">b</span><span class="cm-operator">-</span><span class="cm-variable">a</span>) <span class="cm-operator">+</span> (<span class="cm-variable">b</span><span class="cm-operator">**</span><span class="cm-number">4</span> <span class="cm-operator">-</span> <span class="cm-variable">a</span><span class="cm-operator">**</span><span class="cm-number">4</span>) <span class="cm-operator">/</span> <span class="cm-number">4.</span> <span class="cm-operator">-</span> (<span class="cm-number">1.</span><span class="cm-operator">/</span><span class="cm-variable">k</span>) <span class="cm-operator">*</span> (<span class="cm-variable">cos</span>(<span class="cm-variable">k</span><span class="cm-operator">*</span><span class="cm-variable">b</span>) <span class="cm-operator">-</span> <span class="cm-variable">cos</span>(<span class="cm-variable">k</span><span class="cm-operator">*</span><span class="cm-variable">a</span>))</pre><pre>    <span class="cm-keyword">return</span> <span class="cm-variable">f2</span>, <span class="cm-variable">int_true</span></pre><pre>    </pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>First create a version of <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-30-Frame" class="MathJax"><nobr><span id="MathJax-Span-353" class="math"><span style="display: inline-block; position: relative; width: 12px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.362em, 1000em, 2.632em, -0.671em); top: -2.214em; left: 0em;"><span id="MathJax-Span-354" class="mrow"><span id="MathJax-Span-355" class="msubsup"><span style="display: inline-block; position: relative; width: 0.687em; height: 0px;"><span style="position: absolute; clip: rect(1.711em, 1000em, 2.946em, -0.671em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-356" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.089em; left: 0.262em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-357" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.214em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.244em; vertical-align: -0.361em;"></span></span></nobr></span><script id="MathJax-Element-30" type="math/tex">f_2</script> with <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-31-Frame" class="MathJax"><nobr><span id="MathJax-Span-358" class="math"><span style="display: inline-block; position: relative; width: 48px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.701em, 1000em, 2.753em, -0.51em); top: -2.564em; left: 0em;"><span id="MathJax-Span-359" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-360" class="mi">k<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.017em;"></span></span><span style="font-family: STIXGeneral; padding-left: 0.313em;" id="MathJax-Span-361" class="mo">=</span><span style="font-family: STIXGeneral; padding-left: 0.313em;" id="MathJax-Span-362" class="mn">50</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.982em; vertical-align: -0.087em;"></span></span></nobr></span><script id="MathJax-Element-31" type="math/tex">k=50</script>:</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[119]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 100px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-variable">k</span> = <span class="cm-number">50.</span></pre><pre><span class="cm-variable">a2</span> = <span class="cm-number">0.</span></pre><pre><span class="cm-variable">b2</span> = <span class="cm-number">2.</span></pre><pre><span class="cm-variable">f2</span>, <span class="cm-variable">int_true2</span> = <span class="cm-variable">f2_factory</span>(<span class="cm-variable">k</span>, <span class="cm-variable">a2</span>, <span class="cm-variable">b2</span>)</pre><pre><span class="cm-keyword">print</span> <span class="cm-string">"true integral: %22.14e"</span> <span class="cm-operator">%</span> <span class="cm-variable">int_true2</span></pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_text output_stream output_stdout"><pre>true integral:   6.00275362255425e+00
+</pre></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>For this function with k=50, using n=10 points is not going to give a very good approximation:</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[120]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 29.6px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-variable">plot_trap</span>(<span class="cm-variable">f2</span>,<span class="cm-variable">a2</span>,<span class="cm-variable">b2</span>,<span class="cm-number">10</span>)</pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_png"><div class="ui-wrapper ui-resizable-autohide" style="overflow: hidden; position: relative; width: 373px; height: 253px; top: 0px; left: 0px; margin: 0px;"><img style="resize: none; position: static; display: block; height: 253px; width: 373px;" class="ui-resizable" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXUAAAD9CAYAAABDaefJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz%0AAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVPX+P/DXICq4pCiKJigKaqggiyyS4FgIKrmWqXVz%0AQc3b4tLta95SC0vMrpWpLT+zUtPbdr03NxTUdMDcEEVFFgUUAzfcxY318/vj48As58wcZgaGObyf%0Aj4ePnDPnc87nMPmaD5/zOZ+PgjHGQAghRBbsrF0BQgghlkOhTgghMkKhTgghMkKhTgghMkKhTggh%0AMkKhTgghMmI01GNiYuDi4gJvb2+99z777DPY2dnh5s2btVI5QgghNWM01KdMmYKEhAS97QUFBdi9%0Aeze6dOlSKxUjhBBSc0ZDPSwsDE5OTnrb//GPf+Bf//pXrVSKEEKIaexNKbRlyxa4urrCx8fH4H4K%0AhcKkShFCSENn6sP+Nb5R+uDBAyxZsgSLFi2SdHLGmGz/fPDBB1avA10bXR9dn/z+mKPGoZ6Xl4f8%0A/Hz07dsXXbt2RWFhIQICAlBUVGRWRQghhJivxt0v3t7euHr1atXrrl274tixY2jTpo1FK0YIIaTm%0AjLbUJ0yYgNDQUJw9exZubm5Yu3at1vsNud9cqVRauwq1Rs7XBtD12Tq5X585FMzcDhxDB1cozO4f%0AIoSQhsac7KQnSgkhREYo1AkhREYo1AkhREYo1AkhREYo1AkhREYo1AkhREYo1A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ustREZGWrIaFmVvb48ffvgBo0ePRnl5OaZPnw4vLy+sXr0a%0AADBjxgwMGzYMycnJ8Pb2RvPmzbF27Vor11o6Kde3adMmfPPNN7C3t4ePj4/gjdT6asKECUhKSsL1%0A69fh5uaGRYsWoaysDIDtf3aA8euz5c/uwIED2LhxY9XwZ4BPUfLXX38BsP3PT8r1mfL5WWRCL0II%0AIfUDrXxECCEyQqFOCCEyQqFOCCEyQqFOCCEyQqFOCCEyQqFOCCEy8v8B1aA7adiSgiMAAAAASUVO%0ARK5CYII=%0A"><div style="display: none;" class="ui-resizable-handle ui-resizable-e"></div><div style="display: none;" class="ui-resizable-handle ui-resizable-s"></div><div style="z-index: 1001; display: none;" class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se"></div></div></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>This doesn't look very good, but for larger values of <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-32-Frame" class="MathJax"><nobr><span id="MathJax-Span-363" class="math"><span style="display: inline-block; position: relative; width: 9px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.748em, -0.51em); top: -2.564em; left: 0em;"><span id="MathJax-Span-364" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-365" class="mi">n</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.68em; vertical-align: -0.081em;"></span></span></nobr></span><script id="MathJax-Element-32" type="math/tex">n</script> we still see the expected convergence rate:</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[121]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 29.6px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-variable">error_plot</span>(<span class="cm-variable">f2</span>,<span class="cm-variable">a2</span>,<span class="cm-variable">b2</span>,<span class="cm-variable">nvals</span>,<span class="cm-variable">int_true2</span>)</pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_png"><div class="ui-wrapper ui-resizable-autohide" style="overflow: hidden; position: relative; width: 394px; height: 278px; top: 0px; left: 0px; margin: 0px;"><img style="resize: none; position: static; display: block; height: 278px; width: 394px;" class="ui-resizable" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYoAAAEWCAYAAAB42tAoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz%0AAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xt8VOWdx/FPIJKoVFlaRUmyjSRbBCRABKrUhLCUBE1B%0Ao0WStkATioBtEmgX5boEgSKtLSWp4o2LIqYoxQ12KgTklYuixHBreAGFBWY3G1QULHcSEmb/OJoS%0ACblMzsw5M/N9v155yZzMnPnJIfPN8zzneZ4gl8vlQkRE5BraWV2AiIjYm4JCRESapKAQEZEmKShE%0ARKRJCgoREWmSgkJERJqkoBARkSYpKEREpEnBVhcAUF1dzYwZM7hw4QIPPvggw4cPt7okERH5ki1a%0AFO+//z4DBgxg2bJlrF+/3upyRETkCh4LioyMDLp06ULv3r0bHC8pKSE2NpaYmBjy8vIAqKioICoq%0ACoALFy54qiQREXGDx4IiPT2djRs3NjhWV1dHRkYG69evZ8eOHSxfvpz9+/cTExPDkSNHALjhhhs8%0AVZKIiLjBY2MUcXFxOJ3OBsfKysqIjo4mMjISgNTUVAoKCpg6dSqzZs3i/fff5+GHH77mOYOCgjxV%0AroiI32rr2q9eHaOoqqoiIiKi/nF4eDhVVVWEhITwzDPPkJeXR1JSUpPncLlcln7NnTvXFudrzeua%0Ae66732/NcbP/3uxw/exw7Zp7jjvfs+v188efPbOvX2PHzODVoDCjRZCTk0NRUVHbi3FTQkKCLc7X%0Amtc191x3v9/a43ZgZm12uHbNPced79n1+vnjz15zz2nt9648VlRURE5OTrPv3xJBLrMipxFOp5MR%0AI0ZQUVEBwIcffkhOTk792MWiRYto164dTz75ZMuKDQoyLSHFu3Jyckz7Ryvep+vnu8z43PRqi6J/%0A//4cOnQIp9NJTU0Na9euZeTIka06h9UtCnGPXX9LlZbR9fM9PtGiSEtLo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o0S5YsAYzNYD788EN27dpFZGQk%0Av/nNbwCYP38+LpeLvXv3smfPHoYMGVJ/nq8cOHCAhx9+mL179+J0Ovnggw8AmDt3Lk8//TS7d++m%0Aqqqq0aWgXS4XJSUlzJs3j127drFhw4YGq4CKeJuCQgJGjx49KCsr41e/+hUVFRXcdNNN9d8bM2YM%0AQUFB/PSnP6WwsBCAzz77jAkTJtC7d29WrFjBvn37AHj33XeZNGkSN9xwAwCdOnW66r3CwsIYOnQo%0A7dq1Y/DgwXzwwQfU1NSwZ88eHnroIYKDg/nJT37CtZZaGzhwIN27dyckJIRBgwaxbds2s/86RFpM%0AQSEB47bbbmPPnj306dOHCRMm8Nxzz9V/r7EP7IULF3LvvfeyZ88enn766QYb0Te3luaV4dGhQweq%0Aq6uvek5T57hyW8sOHTpw8eLFJt9PxJMUFBIwPv74YwDGjh1LdnY2u3fvBowP7DVr1lBXV8err75a%0A3yVVVVVFdHQ0Fy9e5JVXXqk/z7Bhw3j++ec5f/48AP/4xz+afW+Xy0WHDh3o27cvGzZs4NKlS7z+%0A+utm/y+KeISCQgJGRUUF3/3ud4mNjWXNmjU88cQTgDG2cNNNN9GrVy/y8/OZOnUqADNnzmTKlCnE%0AxcXRt2/f+vGE2bNnExQURM+ePenbty9FRUVXvdfXxx6+ejx37lyeeOIJ+vXrx4033sjNN9/c6Guv%0A9XoRK2g/Cgl4d9xxBzt27KBz584ef69z585x4403UldXx7Rp03C5XPWD5yJ2pRaFBDxv/rbucDjo%0A168f3bp149ChQ8yePdtr7y3iLrUoRESkSWpRiIhIkxQUIiLSJAWFiIg0SUEhIiJNUlCIiEiTFBQi%0AItKk/wfkA5fHgeT/QAAAAABJRU5ErkJggg==%0A"><div style="display: none;" class="ui-resizable-handle ui-resizable-e"></div><div style="display: none;" class="ui-resizable-handle ui-resizable-s"></div><div style="z-index: 1001; display: none;" class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se"></div></div></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>Now make the function much more oscillatory with a larger value of <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-33-Frame" class="MathJax"><nobr><span id="MathJax-Span-366" class="math"><span style="display: inline-block; position: relative; width: 8px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.75em, -0.51em); top: -2.564em; left: 0em;"><span id="MathJax-Span-367" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-368" class="mi">k<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.017em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.973em; vertical-align: -0.083em;"></span></span></nobr></span><script id="MathJax-Element-33" type="math/tex">k</script>...</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[122]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71661px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 64.8px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-variable">k</span> = <span class="cm-number">1000.</span></pre><pre><span class="cm-variable">f2</span>, <span class="cm-variable">int_true2</span> = <span class="cm-variable">f2_factory</span>(<span class="cm-variable">k</span>,<span class="cm-variable">a2</span>,<span class="cm-variable">b2</span>)</pre><pre><span class="cm-keyword">print</span> <span class="cm-string">"true integral: %22.14e"</span> <span class="cm-operator">%</span> <span class="cm-variable">int_true2</span></pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_text output_stream output_stdout"><pre>true integral:   6.00136745954910e+00
+</pre></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>For the previous choice of nvals the method does not seem to be doing well:</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[123]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 64.8px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-variable">nvals</span> = <span class="cm-variable">array</span>([<span class="cm-number">5</span>, <span class="cm-number">10</span>, <span class="cm-number">20</span>, <span class="cm-number">40</span>, <span class="cm-number">80</span>, <span class="cm-number">160</span>, <span class="cm-number">320</span>])</pre><pre><span class="cm-keyword">print</span> <span class="cm-string">"nvals = "</span>,<span class="cm-variable">nvals</span></pre><pre><span class="cm-variable">error_plot</span>(<span class="cm-variable">f2</span>,<span class="cm-variable">a2</span>,<span class="cm-variable">b2</span>,<span class="cm-variable">nvals</span>,<span class="cm-variable">int_true2</span>, <span class="cm-variable">trapezoid</span>)</pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_text output_stream output_stdout"><pre>nvals =  [  5  10  20  40  80 160 320]
+</pre></div></div><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_png"><div class="ui-wrapper ui-resizable-autohide" style="overflow: hidden; position: relative; width: 394px; height: 278px; top: 0px; left: 0px; margin: 0px;"><img style="resize: none; position: static; display: block; height: 278px; width: 394px;" class="ui-resizable" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYoAAAEWCAYAAAB42tAoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz%0AAAALEgAACxIB0t1+/AAAHr9JREFUeJzt3Xt0FGWexvGnuQWRRcUjKISdQPAS5C6iMiBhFKLkBEcU%0AhdkBSQ4weCHAeEDlYhIQhBlnGMiqkRFcEUXUwQluO4BcOs0KEuU2UQJESNhMdNSBFRBIQpraP0qi%0AkaTopKu7upPv55w+0tXdVT95ST95633rLZdhGIYAAKhBI6cLAACEN4ICAGCJoAAAWCIoAACWCAoA%0AgCWCAgBgiaAAAFgiKAAAlsIiKAoLCzVu3DiNGDHC6VIAAD8RFkHRsWNHvfzyy06XAQCoRtCCIiUl%0ARW3btlW3bt2qbPd6verdu7e6d++uzMzMYB0eAGCToAVFcnKy1q1bV2Wbz+dTSkqK1qxZo507d2rZ%0AsmXKz88PVgkAABs0CdaOBwwYoKKioirbcnNz1blzZ8XExEiSRo4cqezsbLVt21YzZszQnj17tHDh%0AQj3xxBMX7M/lcgWrVACo1wJd+zWkYxQlJSXq0KFD5fPo6GiVlJSodevWysrKUkFBQbUhcZ5hGI4/%0A0tLSwmJ//n7On/dd7D01vV6b7Xb/vYVD+wW77exov9q+Vtu2jtS2C5f2C8XPnh1CGhT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GE2ePFl79uyRZH5hv/766/L5fFqxYkXlKamSkhJ17txZpaWlevXVVyv3M3jwYGVlZen06dOSpG+/%0A/faixzYMQ82aNVPPnj21du1anT17Vm+88Ybd/4tAUBAUaDDy8vJ0yy23qHfv3nr99dc1ffp0SebY%0AQqtWrXTjjTdq1apVmjp1qiRpxowZmjJligYMGKCePXtWjifMmjVLLpdLXbp0Uc+ePeXxeC441k/H%0AHs4/T0tL0/Tp09WrVy9deumluuyyy6r9bE2fB5zA/SjQ4HXs2FE7d+5U69atg36sU6dO6dJLL5XP%0A59O0adNkGEbl4DkQruhRoMEL5W/rbrdbvXr1UqdOnVRQUKBZs2aF7NhAXdGjAABYokcBALBEUAAA%0ALBEUAABLBAUAwBJBAQCwRFAAACz9P0rU4mPCKMqNAAAAAElFTkSuQmCC%0A"><div style="display: none;" class="ui-resizable-handle ui-resizable-e"></div><div style="display: none;" class="ui-resizable-handle ui-resizable-s"></div><div style="z-index: 1001; display: none;" class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se"></div></div></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>In this case the <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-34-Frame" class="MathJax"><nobr><span id="MathJax-Span-369" class="math"><span style="display: inline-block; position: relative; width: 44px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.501em, 1000em, 2.916em, -0.464em); top: -2.564em; left: 0em;"><span id="MathJax-Span-370" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-371" class="mi">O</span><span style="font-family: STIXGeneral;" id="MathJax-Span-372" class="mo">(</span><span id="MathJax-Span-373" class="msubsup"><span style="display: inline-block; position: relative; width: 0.949em; height: 0px;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-374" class="mi">h</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.741em; left: 0.524em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-375" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-376" class="mo">)</span><span style="font-family: STIXGeneral;" id="MathJax-Span-377" class="mtext">&nbsp;</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.418em; vertical-align: -0.282em;"></span></span></nobr></span><script id="MathJax-Element-34" type="math/tex">O(h^2)~</script> behavior does not become apparent unless we use much smaller <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-35-Frame" class="MathJax"><nobr><span id="MathJax-Span-378" class="math"><span style="display: inline-block; position: relative; width: 9px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -2.564em; left: 0em;"><span id="MathJax-Span-379" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-380" class="mi">h</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.97em; vertical-align: -0.081em;"></span></span></nobr></span><script id="MathJax-Element-35" type="math/tex">h</script> values so that we are resolving the oscillations:</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[124]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 64.8px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-variable">nvals</span> = <span class="cm-variable">array</span>([<span class="cm-number">5</span> <span class="cm-operator">*</span> <span class="cm-number">2</span><span class="cm-operator">**</span><span class="cm-variable">i</span> <span class="cm-keyword">for</span> <span class="cm-variable">i</span> <span class="cm-operator">in</span> <span class="cm-builtin">range</span>(<span class="cm-number">12</span>)])</pre><pre><span class="cm-keyword">print</span> <span class="cm-string">"nvals = "</span>,<span class="cm-variable">nvals</span></pre><pre><span class="cm-variable">error_plot</span>(<span class="cm-variable">f2</span>,<span class="cm-variable">a2</span>,<span class="cm-variable">b2</span>,<span class="cm-variable">nvals</span>,<span class="cm-variable">int_true2</span>,<span class="cm-variable">trapezoid</span>)</pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_text output_stream output_stdout"><pre>nvals =  [    5    10    20    40    80   160   320   640  1280  2560  5120 10240]
+</pre></div></div><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_png"><div class="ui-wrapper ui-resizable-autohide" style="overflow: hidden; position: relative; width: 394px; height: 278px; top: 0px; left: 0px; margin: 0px;"><img style="resize: none; position: static; display: block; height: 278px; width: 394px;" class="ui-resizable" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYoAAAEWCAYAAAB42tAoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz%0AAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtcVXW+//EXyoiV3exCcZnB4AyiggpqaYOXSmnGwUbP%0AmDCTGnsqdfJ6yjIvA2QX6zSnEWbMbngyHcapoTCZ8E5YKaSmQ6mjo+4zHDzlmL/MKwqs3x9rYCQ2%0AyGXtvfZmv5+PB4/a371Z68P3IevD9x5gGIaBiIhIIzrYHYCIiHg3JQoREWmSEoWIiDRJiUJERJqk%0ARCEiIk1SohARkSYpUYiISJOUKEREpElekygOHz7MAw88wNixY+0ORURELuI1iaJbt2689tprdoch%0AIiLf4tZE4XA4CA4OJjY2tl55cXEx8fHxxMXFkZ2d7c4QRESkjdyaKNLS0igsLKxXVl1djcPhIC8v%0Ajx07dvD666+zd+9ed4YhIiJtEOjOiycmJuJ0OuuVlZaWEhUVRUREBAApKSnk5+cTHBzM3Llz2bVr%0AF8899xyPP/54g+sFBAS4M1wRkXaprXu/enyMoqKigvDw8LrXYWFhVFRU0LVrV5YuXcqBAwdcJola%0A6enpbN68GcMw3PKVnp7u9u+71Gebet/Ve80pu9Rrb6pLT9VnS8r9pT6t/rep+rS2PltStnnzZtLT%0A0y15bru1ReFKW1sFGRkZ1gTSi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oULMQyDzz77jN27dzNs2LC669Tat28fY8aM4bPPPsPpdLJ161bAPN990aJF7Nq1i4qKCpdb%0AQRuGQXFxMZmZmXz66aesXr263i6gIp6mRCF+IyYmhtLSUh555BHKysq46qqr6t4bP348AQEB3H//%0A/axbtw6Af/zjHzz44IPExsaSk5PDnj17ANi4cSOTJ0/m8ssvB+Caa65pcK/Q0FDuvPNOOnTowJAh%0AQ9i6dSvnz59n9+7d/OQnPyEwMJD77ruPxrZaGzBgANHR0QQFBTFo0CA+/vhjq6tDpNmUKMRv3HTT%0ATezevZvevXvz4IMPsmTJkrr3XD2wn376aQYOHMju3btZtGhRvYPoL7WX5sXJo1OnTlRWVjb4TFPX%0AuPbaa+t9/7lz55q8n4g7KVGI3/i///s/ACZMmMCMGTPYtWsXYD6wV65cSXV1NcuXL6/rkqqoqCAq%0AKopz587xxhtv1F1n+PDhLF26lDNnzgDw9ddfX/LehmHQqVMn+vTpw+rVq7lw4QK///3vrf4RRdxC%0AiUL8RllZGbfeeivx8fGsXLmSxx57DDDHFq666ip69uxJbm4us2bNAmDu3LnMnDmTxMRE+vTpUzee%0AMH/+fAICAujRowd9+vShqKiowb2+PfZQ+zo9PZ3HHnuMvn37csUVV3D11Ve7/N7Gvl/EDjqPQvxe%0At27d2LFjB127dnX7vU6fPs0VV1xBdXU1s2fPxjCMusFzEW+lFoX4PU/+tV5QUEDfvn255ZZbOHDg%0AAPPnz/fYvUVaSy0KERFpkloUIiLSJCUKERFpkhKFiIg0SYlCRESapEQhIiJNUqIQEZEm/X8/nhaK%0Alq517gAAAABJRU5ErkJggg==%0A"><div style="display: none;" class="ui-resizable-handle ui-resizable-e"></div><div style="display: none;" class="ui-resizable-handle ui-resizable-s"></div><div style="z-index: 1001; display: none;" class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se"></div></div></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>Eventually we see second order convergence and ratios that approach 4:</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[125]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 29.6px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-variable">error_table</span>(<span class="cm-variable">f2</span>,<span class="cm-variable">a2</span>,<span class="cm-variable">b2</span>,<span class="cm-variable">nvals</span>,<span class="cm-variable">int_true2</span>,<span class="cm-variable">trapezoid</span>)</pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_text output_stream output_stdout"><pre>      n         approximation        error       ratio
+       5    6.16511276525547e+00   1.637e-01   0.000e+00
+      10    6.11640342954375e+00   1.150e-01   1.423e+00
+      20    5.93766915031525e+00   6.370e-02   1.806e+00
+      40    6.06556743605608e+00   6.420e-02   9.922e-01
+      80    6.18855102747922e+00   1.872e-01   3.430e-01
+     160    7.40477216296790e+00   1.403e+00   1.334e-01
+     320    5.36931843072561e+00   6.320e-01   2.220e+00
+     640    6.00002231770676e+00   1.345e-03   4.699e+02
+    1280    6.00107919913986e+00   2.883e-04   4.666e+00
+    2560    6.00129774432062e+00   6.972e-05   4.135e+00
+    5120    6.00135017283866e+00   1.729e-05   4.033e+00
+   10240    6.00136314705017e+00   4.312e-06   4.009e+00
+</pre></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><h2>Simpson's Rule</h2></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>There
+ are much better methods than the Trapezoidal rule that are not much 
+harder to implement but get much smaller errors with the same number of 
+function evaluations. One such method is Simpson’s rule, which 
+approximates the integral over a single interval from <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-36-Frame" class="MathJax"><nobr><span id="MathJax-Span-381" class="math"><span style="display: inline-block; position: relative; width: 12px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.599em, 1000em, 2.547em, -0.551em); top: -2.214em; left: 0em;"><span id="MathJax-Span-382" class="mrow"><span id="MathJax-Span-383" class="msubsup"><span style="display: inline-block; position: relative; width: 0.713em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-384" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-385" class="mi">i</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.214em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.858em; vertical-align: -0.259em;"></span></span></nobr></span><script id="MathJax-Element-36" type="math/tex">x_i</script> to <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-37-Frame" class="MathJax"><nobr><span id="MathJax-Span-386" class="math"><span style="display: inline-block; position: relative; width: 27px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.599em, 1000em, 2.568em, -0.551em); top: -2.214em; left: 0em;"><span id="MathJax-Span-387" class="mrow"><span id="MathJax-Span-388" class="msubsup"><span style="display: inline-block; position: relative; width: 1.587em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-389" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-390" class="texatom"><span id="MathJax-Span-391" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-392" class="mi">i</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-393" class="mo">+</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-394" class="mn">1</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.214em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.884em; vertical-align: -0.285em;"></span></span></nobr></span><script id="MathJax-Element-37" type="math/tex">x_{i+1}</script> by
+<span class="MathJax_Preview"></span><div style="text-align: left;" aria-readonly="true" role="textbox" class="MathJax_Display"><span style="" id="MathJax-Element-38-Frame" class="MathJax"><nobr><span style="margin-left: 0em;" id="MathJax-Span-395" class="math"><span style="display: inline-block; position: relative; width: 333px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(0.966em, 1000em, 3.77em, -0.468em); top: -2.564em; left: 0em;"><span id="MathJax-Span-396" class="mrow"><span id="MathJax-Span-397" class="msubsup"><span style="display: inline-block; position: relative; width: 2.409em; height: 0px;"><span style="position: absolute; clip: rect(2.112em, 1000em, 4.731em, -0.468em); top: -3.671em; left: 0em;"><span style="font-family: STIXIntegralsD; vertical-align: -0.615em;" id="MathJax-Span-398" class="mo">∫<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.45em;"></span></span><span style="display: inline-block; width: 0px; height: 3.671em;"></span></span><span style="position: absolute; clip: rect(3.534em, 1000em, 4.322em, -0.544em); top: -5.132em; left: 1.234em;"><span id="MathJax-Span-399" class="texatom"><span id="MathJax-Span-400" class="mrow"><span id="MathJax-Span-401" class="msubsup"><span style="display: inline-block; position: relative; width: 1.1em; height: 0px;"><span style="position: absolute; clip: rect(1.844em, 1000em, 2.514em, -0.544em); top: -2.331em; left: 0em;"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-402" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.002em;"></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span><span style="position: absolute; top: -2.108em; left: 0.289em;"><span id="MathJax-Span-403" class="texatom"><span id="MathJax-Span-404" class="mrow"><span style="font-size: 50%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-405" class="mi">i</span><span style="font-size: 50%; font-family: STIXGeneral;" id="MathJax-Span-406" class="mo">+</span><span style="font-size: 50%; font-family: STIXGeneral;" id="MathJax-Span-407" class="mn">1</span></span></span><span style="display: inline-block; width: 0px; height: 2.214em;"></span></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 4.021em;"></span></span><span style="position: absolute; clip: rect(3.534em, 1000em, 4.307em, -0.544em); top: -3.101em; left: 0.599em;"><span id="MathJax-Span-408" class="texatom"><span id="MathJax-Span-409" class="mrow"><span id="MathJax-Span-410" class="msubsup"><span style="display: inline-block; position: relative; width: 0.459em; height: 0px;"><span style="position: absolute; clip: rect(1.844em, 1000em, 2.514em, -0.544em); top: -2.331em; left: 0em;"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-411" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.002em;"></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span><span style="position: absolute; top: -2.108em; left: 0.289em;"><span style="font-size: 50%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-412" class="mi">i</span><span style="display: inline-block; width: 0px; height: 2.214em;"></span></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 4.021em;"></span></span></span></span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.188em;" id="MathJax-Span-413" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-414" class="mo">(</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-415" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-416" class="mo">)</span><span style="font-family: STIXGeneral;" id="MathJax-Span-417" class="mo">,</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.188em;" id="MathJax-Span-418" class="mi">d<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.027em;"></span></span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-419" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="font-family: STIXGeneral; padding-left: 0.313em;" id="MathJax-Span-420" class="mo">≈</span><span style="padding-left: 0.432em; padding-right: 0.12em;" id="MathJax-Span-421" class="mfrac"><span style="display: inline-block; position: relative; width: 0.644em; height: 0px;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -3.241em; left: 50%; margin-left: -0.262em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-422" class="mi">h</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; clip: rect(1.705em, 1000em, 2.753em, -0.49em); top: -1.878em; left: 50%; margin-left: -0.262em;"><span style="font-family: STIXGeneral;" id="MathJax-Span-423" class="mn">6</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; clip: rect(0.801em, 1000em, 1.224em, -0.524em); top: -1.269em; left: 0em;"><span style="border-left: 0.644em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.25px; vertical-align: 0em;"></span><span style="display: inline-block; width: 0px; height: 1.049em;"></span></span></span></span><span style="font-family: STIXGeneral; padding-left: 0.188em;" id="MathJax-Span-424" class="mo">(</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-425" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-426" class="mo">(</span><span id="MathJax-Span-427" class="msubsup"><span style="display: inline-block; position: relative; width: 0.713em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-428" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-429" class="mi">i</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-430" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-431" class="mo">+</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-432" class="mn">4</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-433" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-434" class="mo">(</span><span id="MathJax-Span-435" class="msubsup"><span style="display: inline-block; position: relative; width: 2.112em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-436" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-437" class="texatom"><span id="MathJax-Span-438" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-439" class="mi">i</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-440" class="mo">+</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-441" class="mn">1</span><span id="MathJax-Span-442" class="texatom"><span id="MathJax-Span-443" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-444" class="mo">/</span></span></span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-445" class="mn">2</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-446" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-447" class="mo">+</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.25em;" id="MathJax-Span-448" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-449" class="mo">(</span><span id="MathJax-Span-450" class="msubsup"><span style="display: inline-block; position: relative; width: 1.587em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-451" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-452" class="texatom"><span id="MathJax-Span-453" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-454" class="mi">i</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-455" class="mo">+</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-456" class="mn">1</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-457" class="mo">)</span><span style="font-family: STIXGeneral;" id="MathJax-Span-458" class="mo">)</span><span style="font-family: STIXGeneral;" id="MathJax-Span-459" class="mo">,</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 3.086em; vertical-align: -1.308em;"></span></span></nobr></span></div><script id="MathJax-Element-38" type="math/tex; mode=display">\int_{x_i}^{x_{i+1}} f(x), dx \approx \frac h 6 (f(x_i) + 4f(x_{i+1/2}) + f(x_{i+1})),</script>
+where <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-39-Frame" class="MathJax"><nobr><span id="MathJax-Span-460" class="math"><span style="display: inline-block; position: relative; width: 227px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.492em, 1000em, 3.136em, -0.551em); top: -2.564em; left: 0em;"><span id="MathJax-Span-461" class="mrow"><span id="MathJax-Span-462" class="msubsup"><span style="display: inline-block; position: relative; width: 2.112em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-463" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-464" class="texatom"><span id="MathJax-Span-465" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-466" class="mi">i</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-467" class="mo">+</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-468" class="mn">1</span><span id="MathJax-Span-469" class="texatom"><span id="MathJax-Span-470" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-471" class="mo">/</span></span></span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-472" class="mn">2</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral; padding-left: 0.313em;" id="MathJax-Span-473" class="mo">=</span><span style="padding-left: 0.432em; padding-right: 0.12em;" id="MathJax-Span-474" class="mfrac"><span style="display: inline-block; position: relative; width: 0.47em; height: 0px;"><span style="position: absolute; clip: rect(1.678em, 1000em, 2.506em, -0.446em); top: -2.75em; left: 50%; margin-left: -0.175em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-475" class="mn">1</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span><span style="position: absolute; clip: rect(1.678em, 1000em, 2.506em, -0.504em); top: -1.934em; left: 50%; margin-left: -0.175em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-476" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span><span style="position: absolute; clip: rect(0.801em, 1000em, 1.224em, -0.524em); top: -1.269em; left: 0em;"><span style="border-left: 0.47em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.25px; vertical-align: 0em;"></span><span style="display: inline-block; width: 0px; height: 1.049em;"></span></span></span></span><span style="font-family: STIXGeneral; padding-left: 0.188em;" id="MathJax-Span-477" class="mo">(</span><span id="MathJax-Span-478" class="msubsup"><span style="display: inline-block; position: relative; width: 0.713em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-479" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-480" class="mi">i</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-481" class="mo">+</span><span style="padding-left: 0.25em;" id="MathJax-Span-482" class="msubsup"><span style="display: inline-block; position: relative; width: 1.587em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-483" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-484" class="texatom"><span id="MathJax-Span-485" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-486" class="mi">i</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-487" class="mo">+</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-488" class="mn">1</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-489" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.313em;" id="MathJax-Span-490" class="mo">=</span><span style="padding-left: 0.313em;" id="MathJax-Span-491" class="msubsup"><span style="display: inline-block; position: relative; width: 0.713em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-492" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-493" class="mi">i</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-494" class="mo">+</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.25em;" id="MathJax-Span-495" class="mi">h</span><span id="MathJax-Span-496" class="texatom"><span id="MathJax-Span-497" class="mrow"><span style="font-family: STIXGeneral;" id="MathJax-Span-498" class="mo">/</span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-499" class="mn">2.</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.693em; vertical-align: -0.547em;"></span></span></nobr></span><script id="MathJax-Element-39" type="math/tex">x_{i+1/2} = \frac 1 2 (x_i + x_{i+1}) = x_i + h/2.</script></p>
+
+<p>Derivation: The trapezoid method is derived by approximating the 
+function on each interval by a linear function interpolating at the two 
+endpoints of each interval and then integrating this linear function.  
+Simpson's method is derived by approximating the function by a quadratic
+ function interpolating at the endpoints and the center of the interval 
+and integrating this quadratic function.</p></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>Adding this up over <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-40-Frame" class="MathJax"><nobr><span id="MathJax-Span-500" class="math"><span style="display: inline-block; position: relative; width: 38px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.713em, 1000em, 2.748em, -0.51em); top: -2.564em; left: 0em;"><span id="MathJax-Span-501" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-502" class="mi">n</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-503" class="mo">−</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-504" class="mn">1</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.962em; vertical-align: -0.081em;"></span></span></nobr></span><script id="MathJax-Element-40" type="math/tex">n-1</script>  intervals gives the approximation
+<span class="MathJax_Preview"></span><div style="text-align: left;" aria-readonly="true" role="textbox" class="MathJax_Display"><span style="" id="MathJax-Element-41-Frame" class="MathJax"><nobr><span style="margin-left: 0em;" id="MathJax-Span-505" class="math"><span style="display: inline-block; position: relative; width: 608px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.03em, 1000em, 3.439em, -0.404em); top: -2.564em; left: 0em;"><span id="MathJax-Span-506" class="mrow"><span style="padding-left: 0.12em; padding-right: 0.12em;" id="MathJax-Span-507" class="mfrac"><span style="display: inline-block; position: relative; width: 0.644em; height: 0px;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.748em, -0.505em); top: -3.241em; left: 50%; margin-left: -0.262em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-508" class="mi">h</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; clip: rect(1.705em, 1000em, 2.753em, -0.49em); top: -1.878em; left: 50%; margin-left: -0.262em;"><span style="font-family: STIXGeneral;" id="MathJax-Span-509" class="mn">6</span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; clip: rect(0.801em, 1000em, 1.224em, -0.524em); top: -1.269em; left: 0em;"><span style="border-left: 0.644em solid; display: inline-block; overflow: hidden; width: 0px; height: 1.25px; vertical-align: 0em;"></span><span style="display: inline-block; width: 0px; height: 1.049em;"></span></span></span></span><span style="font-family: STIXGeneral; padding-left: 0.188em;" id="MathJax-Span-510" class="mo">[</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-511" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-512" class="mo">(</span><span id="MathJax-Span-513" class="msubsup"><span style="display: inline-block; position: relative; width: 0.888em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-514" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-515" class="mn">0</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-516" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-517" class="mo">+</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-518" class="mn">4</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-519" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-520" class="mo">(</span><span id="MathJax-Span-521" class="msubsup"><span style="display: inline-block; position: relative; width: 1.471em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-522" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-523" class="texatom"><span id="MathJax-Span-524" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-525" class="mn">1</span><span id="MathJax-Span-526" class="texatom"><span id="MathJax-Span-527" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-528" class="mo">/</span></span></span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-529" class="mn">2</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-530" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-531" class="mo">+</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-532" class="mn">2</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-533" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-534" class="mo">(</span><span id="MathJax-Span-535" class="msubsup"><span style="display: inline-block; position: relative; width: 0.888em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-536" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-537" class="mn">1</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-538" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-539" class="mo">+</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-540" class="mn">4</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-541" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-542" class="mo">(</span><span id="MathJax-Span-543" class="msubsup"><span style="display: inline-block; position: relative; width: 1.471em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-544" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-545" class="texatom"><span id="MathJax-Span-546" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-547" class="mn">3</span><span id="MathJax-Span-548" class="texatom"><span id="MathJax-Span-549" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-550" class="mo">/</span></span></span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-551" class="mn">2</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-552" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-553" class="mo">+</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-554" class="mn">2</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-555" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-556" class="mo">(</span><span id="MathJax-Span-557" class="msubsup"><span style="display: inline-block; position: relative; width: 0.888em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-558" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-559" class="mn">2</span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-560" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-561" class="mo">+</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-562" class="mo">⋯</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-563" class="mo">+</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-564" class="mn">2</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-565" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-566" class="mo">(</span><span id="MathJax-Span-567" class="msubsup"><span style="display: inline-block; position: relative; width: 1.704em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-568" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-569" class="texatom"><span id="MathJax-Span-570" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-571" class="mi">n</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-572" class="mo">−</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-573" class="mn">2</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-574" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-575" class="mo">+</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-576" class="mn">4</span><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-577" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-578" class="mo">(</span><span id="MathJax-Span-579" class="msubsup"><span style="display: inline-block; position: relative; width: 2.286em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-580" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-581" class="texatom"><span id="MathJax-Span-582" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-583" class="mi">n</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-584" class="mo">−</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-585" class="mn">3</span><span id="MathJax-Span-586" class="texatom"><span id="MathJax-Span-587" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-588" class="mo">/</span></span></span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-589" class="mn">2</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-590" class="mo">)</span><span style="font-family: STIXGeneral; padding-left: 0.25em;" id="MathJax-Span-591" class="mo">+</span><span style="font-family: STIXGeneral; font-style: italic; padding-left: 0.25em;" id="MathJax-Span-592" class="mi">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.146em;"></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-593" class="mo">(</span><span id="MathJax-Span-594" class="msubsup"><span style="display: inline-block; position: relative; width: 1.704em; height: 0px;"><span style="position: absolute; clip: rect(1.948em, 1000em, 2.75em, -0.551em); top: -2.564em; left: 0em;"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-595" class="mi">x<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span><span style="position: absolute; top: -2.181em; left: 0.463em;"><span id="MathJax-Span-596" class="texatom"><span id="MathJax-Span-597" class="mrow"><span style="font-size: 70.7%; font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-598" class="mi">n</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-599" class="mo">−</span><span style="font-size: 70.7%; font-family: STIXGeneral;" id="MathJax-Span-600" class="mn">1</span></span></span><span style="display: inline-block; width: 0px; height: 2.331em;"></span></span></span></span><span style="font-family: STIXGeneral;" id="MathJax-Span-601" class="mo">)</span><span style="font-family: STIXGeneral;" id="MathJax-Span-602" class="mo">]</span><span style="font-family: STIXGeneral;" id="MathJax-Span-603" class="mo">.</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 2.611em; vertical-align: -0.91em;"></span></span></nobr></span></div><script id="MathJax-Element-41" type="math/tex; mode=display">\frac{h}{6}[f(x_0) + 4f(x_{1/2}) + 2f(x_1) + 4f(x_{3/2}) + 2f(x_2) + \cdots + 2f(x_{n-2}) + 4f(x_{n-3/2}) + f(x_{n-1})].</script>
+In Python this can be implemented by the following code:</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[126]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 152.8px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-keyword">def</span> <span class="cm-variable">simpson</span>(<span class="cm-variable">f</span>,<span class="cm-variable">a</span>,<span class="cm-variable">b</span>,<span class="cm-variable">n</span>):</pre><pre>    <span class="cm-variable">h</span> = (<span class="cm-variable">b</span><span class="cm-operator">-</span><span class="cm-variable">a</span>)<span class="cm-operator">/</span>(<span class="cm-variable">n</span><span class="cm-operator">-</span><span class="cm-number">1</span>)</pre><pre>    <span class="cm-variable">xj</span> = <span class="cm-variable">linspace</span>(<span class="cm-variable">a</span>,<span class="cm-variable">b</span>,<span class="cm-variable">n</span>)</pre><pre>    <span class="cm-variable">fj</span> = <span class="cm-variable">f</span>(<span class="cm-variable">xj</span>)</pre><pre>    <span class="cm-variable">xc</span> = <span class="cm-variable">linspace</span>(<span class="cm-variable">a</span><span class="cm-operator">+</span><span class="cm-variable">h</span><span class="cm-operator">/</span><span class="cm-number">2</span>,<span class="cm-variable">b</span><span class="cm-operator">-</span><span class="cm-variable">h</span><span class="cm-operator">/</span><span class="cm-number">2</span>,<span class="cm-variable">n</span><span class="cm-operator">-</span><span class="cm-number">1</span>)  <span class="cm-comment"># midpoints of cells</span></pre><pre>    <span class="cm-variable">fc</span> = <span class="cm-variable">f</span>(<span class="cm-variable">xc</span>)</pre><pre>    <span class="cm-variable">int_simpson</span> = (<span class="cm-variable">h</span><span class="cm-operator">/</span><span class="cm-number">6.</span>) <span class="cm-operator">*</span> (<span class="cm-number">2.</span><span class="cm-operator">*</span><span class="cm-builtin">sum</span>(<span class="cm-variable">fj</span>) <span class="cm-operator">-</span> (<span class="cm-variable">fj</span>[<span class="cm-number">0</span>] <span class="cm-operator">+</span> <span class="cm-variable">fj</span>[<span class="cm-operator">-</span><span class="cm-number">1</span>]) <span class="cm-operator">+</span> <span class="cm-number">4.</span><span class="cm-operator">*</span><span class="cm-builtin">sum</span>(<span class="cm-variable">fc</span>))</pre><pre>    <span class="cm-keyword">return</span> <span class="cm-variable">int_simpson</span></pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>This
+ method is 4th order accurate, which means that on fine enough grids the
+ error is proportional to \Delta x^4. Hence increasing n by a factor of 2
+ should decrease the error by a factor of 2^4 = 16.  Let's try it on the
+ last function we were experimenting with:</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[127]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 100px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-variable">k</span> = <span class="cm-number">1000.</span></pre><pre><span class="cm-variable">f2</span>, <span class="cm-variable">int_true2</span> = <span class="cm-variable">f2_factory</span>(<span class="cm-variable">k</span>,<span class="cm-variable">a2</span>,<span class="cm-variable">b2</span>)</pre><pre><span class="cm-keyword">print</span> <span class="cm-string">"true integral: %22.14e"</span> <span class="cm-operator">%</span> <span class="cm-variable">int_true2</span></pre><pre> </pre><pre><span class="cm-variable">error_table</span>(<span class="cm-variable">f2</span>,<span class="cm-variable">a2</span>,<span class="cm-variable">b2</span>,<span class="cm-variable">nvals</span>,<span class="cm-variable">int_true2</span>,<span class="cm-variable">simpson</span>)</pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_text output_stream output_stdout"><pre>true integral:   6.00136745954910e+00
+      n         approximation        error       ratio
+       5    5.73687339985881e+00   2.645e-01   0.000e+00
+      10    5.91163035788901e+00   8.974e-02   2.947e+00
+      20    6.04406704558838e+00   4.270e-02   2.102e+00
+      40    6.06900954932785e+00   6.764e-02   6.313e-01
+      80    6.18844048197182e+00   1.871e-01   3.616e-01
+     160    7.40463149442203e+00   1.403e+00   1.333e-01
+     320    6.21025000380603e+00   2.089e-01   6.718e+00
+     640    6.00143086444865e+00   6.340e-05   3.294e+03
+    1280    6.00137051926171e+00   3.060e-06   2.072e+01
+    2560    6.00136763998022e+00   1.804e-07   1.696e+01
+    5120    6.00136747066329e+00   1.111e-08   1.623e+01
+   10240    6.00136746024111e+00   6.920e-10   1.606e+01
+</pre></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>Note
+ that the errors get smaller much faster and the ratio approaches 16.  
+The improvement over the trapezoid method is seen more clearly if we 
+plot the errors together:</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[128]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 47.2px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-variable">error_plot</span>(<span class="cm-variable">f2</span>,<span class="cm-variable">a2</span>,<span class="cm-variable">b2</span>,<span class="cm-variable">nvals</span>,<span class="cm-variable">int_true2</span>,<span class="cm-variable">trapezoid</span>)</pre><pre><span class="cm-variable">error_plot</span>(<span class="cm-variable">f2</span>,<span class="cm-variable">a2</span>,<span class="cm-variable">b2</span>,<span class="cm-variable">nvals</span>,<span class="cm-variable">int_true2</span>,<span class="cm-variable">simpson</span>)</pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_png"><div class="ui-wrapper ui-resizable-autohide" style="overflow: hidden; position: relative; width: 399px; height: 278px; top: 0px; left: 0px; margin: 0px;"><img style="resize: none; position: static; display: block; height: 278px; width: 399px;" class="ui-resizable" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAY8AAAEWCAYAAACe8xtsAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz%0AAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVPX6wPEPi4JL7kuBJIommqiItHhDMRdUcr8meHOB%0AQrMEt2uZVi5pqdktodLrdUsDMn9hWpQJ6gCaiooLJi6hKBe7qXg1F3bO74+5ksigDMzMmRme9+s1%0Ar5fznbM8HOE8c7bnsVEURUEIIYTQg63aAQghhLA8kjyEEELoTZKHEEIIvUnyEEIIoTdJHkIIIfQm%0AyUMIIYTeJHkIIYTQmyQPIYQQejPb5HH+/HleeeUVRo4cqXYoQggh7mO2yaNVq1asXr1a7TCEEELo%0AYNLkERwcTPPmzfHw8Cg1npiYSNeuXenUqRMRERGmDEkIIUQlmDR5BAUFsX379lJjRUVFBAcHExMT%0Aw+HDh1mzZg1paWmmDEsIIYSe7E25Mh8fHzIyMkqNJScn06ZNG1xdXQEICAhg69atNG/enNmzZ3P0%0A6FGWLFnCm2++WWZ5NjY2JohaCCGsT1Vr4qp+zSMrKwsXF5eS9y1atCArK4tGjRqxcuVKzp49qzNx%0A3KUoilFfc+fONfq8FZmuvGn0Gb9/7GHvrXV7Pujzimy3ioyZYltWZT36zKfG9qyuv5sPmsaQf+uG%0AoHryMPejB19fX6PPW5HpyptGn/H7x6rys1WWOWzPB31eke2mz5ixVXad+synxva0pG2pz7xW9beu%0AmNj58+eVjh07lrzft2+f4ufnV/L+/fffVxYvXlyhZakQvlWbO3eu2iFYDdmWhiXb07AMse9U/cij%0AW7dunD17loyMDPLz89m0aRODBw9WO6xqSY1ve9ZKtqVhyfY0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f91zLuvp87%0Ady5vvPEGnp6e1KlTh/r16+uct7z5hVCL9PMQ4j6tWrXi8OHDNGrUyOjrun37NnXq1KGoqIiZM2ei%0AKErJBXohzJkceQhxH1N+q4+NjcXT05PWrVtz9uxZ3n77bZOtW4iqkCMPIYQQepMjDyGEEHqT5CGE%0AEEJvkjyEEELoTZKHEEIIvUnyEEIIoTdJHkIIIfT2/1qm8mSB/DwwAAAAAElFTkSuQmCC%0A"><div style="display: none;" class="ui-resizable-handle ui-resizable-e"></div><div style="display: none;" class="ui-resizable-handle ui-resizable-s"></div><div style="z-index: 1001; display: none;" class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se"></div></div></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>You might want to experiment with changing <span class="MathJax_Preview"></span><span style="" aria-readonly="true" role="textbox" id="MathJax-Element-42-Frame" class="MathJax"><nobr><span id="MathJax-Span-604" class="math"><span style="display: inline-block; position: relative; width: 8px; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.706em, 1000em, 2.75em, -0.51em); top: -2.564em; left: 0em;"><span id="MathJax-Span-605" class="mrow"><span style="font-family: STIXGeneral; font-style: italic;" id="MathJax-Span-606" class="mi">k<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.017em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="border-left: 0em solid; display: inline-block; overflow: hidden; width: 0px; height: 0.973em; vertical-align: -0.083em;"></span></span></nobr></span><script id="MathJax-Element-42" type="math/tex">k</script> in the two cells above.</p></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><h4>Simpson's method integrates cubic functions exactly</h4></div></div><div tabindex="2" class="cell text_cell border-box-sizing"><div style="display: none;" class="text_cell_input border-box-sizing"><div class="CodeMirror CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-default" tabindex="-1"><div style="position: relative"><div style="position: relative"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"><pre><span>x</span></pre></div><pre class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div></div></div><div tabindex="-1" class="text_cell_render border-box-sizing rendered_html"><p>Even
+ though Simpson'e method is derived by integrating a quadratic 
+approximation of the function, rather than linear as with the Trapezoid 
+Rule, in fact it also integrates a cubic exactly, as seen if we try it 
+out with the function f1 defined at the top of this notebook.  (This is 
+because the error between the cubic and the quadratic approximation on 
+each interval is not zero but does have integral equal to zero since it 
+turns out to be an odd function about the midpoint.)  For this reason 
+Simpson's Rule is fourth order accurate in general rather than only 
+third order, as one might expect when going from a linear to quadratic 
+approximation.</p>
+
+<p>Note the error ratios are whacky as a result.</p></div></div><div tabindex="2" class="cell border-box-sizing code_cell vbox"><div class="input hbox"><div class="prompt input_prompt">In&nbsp;[129]:</div><div class="input_area box-flex1"><div class="CodeMirror"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.71667px; left: 5.71666px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1"><div style="position: relative; height: 29.6px;"><div style="position: relative; top: 0px;"><div style="display: none;" class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div draggable="true" style="position: relative; z-index: 0; outline: medium none;"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden; outline: 5px auto none"></div><pre style="top: 0px; left: 0px;" class="CodeMirror-cursor">&nbsp;</pre><div style="position: relative; z-index: -1; display: none;"></div><div style=""><pre><span class="cm-variable">error_table</span>(<span class="cm-variable">f1</span>,<span class="cm-variable">a1</span>,<span class="cm-variable">b1</span>,<span class="cm-variable">nvals</span>,<span class="cm-variable">int_true1</span>,<span class="cm-variable">simpson</span>)</pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper"><div title="click to expand outout; double click to hide output" class="out_prompt_overlay prompt" style="display: block;"></div><div style="display: -moz-box;" class="output vbox"><div class="hbox output_area"><div class="prompt"></div><div class="box-flex1 output_subarea output_text output_stream output_stdout"><pre>      n         approximation        error       ratio
+       5    6.00000000000000e+00   0.000e+00         nan
+      10    6.00000000000000e+00   0.000e+00         nan
+      20    6.00000000000000e+00   0.000e+00         nan
+      40    6.00000000000000e+00   8.882e-16   0.000e+00
+      80    6.00000000000000e+00   8.882e-16   1.000e+00
+     160    6.00000000000000e+00   0.000e+00         inf
+     320    6.00000000000000e+00   8.882e-16   0.000e+00
+     640    6.00000000000000e+00   1.776e-15   5.000e-01
+    1280    6.00000000000000e+00   0.000e+00         inf
+    2560    6.00000000000000e+00   8.882e-16   0.000e+00
+    5120    6.00000000000000e+00   3.553e-15   2.500e-01
+   10240    6.00000000000000e+00   2.665e-15   1.333e+00
+</pre></div></div></div><div title="click to expand outout" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only output_collapsed vbox" style="display: none;">. . .</div></div></div><div style="height: 30%;" class="end_space"></div></div>
+</div>
+</div>
+
+</div>
+<script src="quadrature2_files/jquery-1.js" type="text/javascript" charset="utf-8"></script>
+<script src="quadrature2_files/jquery-ui.js" type="text/javascript" charset="utf-8"></script>
+<script src="quadrature2_files/namespace.js" type="text/javascript" charset="utf-8"></script>
+<script src="quadrature2_files/page.js" type="text/javascript" charset="utf-8"></script>
+<script src="quadrature2_files/loginwidget.js" type="text/javascript" charset="utf-8"></script>
+
+<script src="quadrature2_files/codemirror.js" charset="utf-8"></script>
+<script src="quadrature2_files/python.js" charset="utf-8"></script>
+<script src="quadrature2_files/htmlmixed.js" charset="utf-8"></script>
+<script src="quadrature2_files/xml.js" charset="utf-8"></script>
+<script src="quadrature2_files/javascript.js" charset="utf-8"></script>
+<script src="quadrature2_files/css.js" charset="utf-8"></script>
+<script src="quadrature2_files/rst.js" charset="utf-8"></script>
+<script src="quadrature2_files/markdown.js" charset="utf-8"></script>
+<script src="quadrature2_files/Markdown.js" charset="utf-8"></script>
+<script src="quadrature2_files/prettify.js" charset="utf-8"></script>
+<script src="quadrature2_files/date.js" charset="utf-8"></script>
+<script src="quadrature2_files/events.js" type="text/javascript" charset="utf-8"></script>
+<script src="quadrature2_files/utils.js" type="text/javascript" charset="utf-8"></script>
+<script src="quadrature2_files/initmathjax.js" type="text/javascript" charset="utf-8"></script>
+<script src="quadrature2_files/outputarea.js" type="text/javascript" charset="utf-8"></script>
+<script src="quadrature2_files/cell.js" type="text/javascript" charset="utf-8"></script>
+<script src="quadrature2_files/codecell.js" type="text/javascript" charset="utf-8"></script>
+<script src="quadrature2_files/textcell.js" type="text/javascript" charset="utf-8"></script>
+<script src="quadrature2_files/kernel.js" type="text/javascript" charset="utf-8"></script>
+<script src="quadrature2_files/notebook.js" type="text/javascript" charset="utf-8"></script>
+<script src="quadrature2_files/printnotebookmain.js" type="text/javascript" charset="utf-8"></script>
+
+
+
+<div style="position: absolute; visibility: hidden; top: 0px; left: 0px; width: auto; padding: 0px; border: 0px none; margin: 0px; white-space: nowrap; text-align: left; text-indent: 0px; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; font-size: 40px; font-weight: normal; font-style: normal; font-size-adjust: none; font-family: 'STIXSizeOneSym',sans-serif;" id="MathJax_Font_Test">ˆ</div></body></html>

File codes/homework5/notebook/quadrature2.ipynb

+{
+ "metadata": {
+  "name": "quadrature2"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+  {
+   "cells": [
+    {
+     "cell_type": "heading",
+     "level": 1,
+     "metadata": {},
+     "source": [
+      "Numerical Quadrature"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Numerical quadrature refers to approximating a definite integral numerically, \n",
+      "$$~~ \\int_a^b f(x) dx.$$\n",
+      "Many numerical analysis textbooks describe a variety of quadrature methods or \"rules\".  "
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "First define a simple function for which we know the exact answer:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "def f1(x):\n",
+      "    return 1. + x**3\n",
+      "\n",
+      "a1 = 0.\n",
+      "b1 = 2.\n",
+      "int_true1 = (b1-a1) + (b1**4 -a1**4) / 4.\n",
+      "print \"true integral: %22.14e\" % int_true1"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "heading",
+     "level": 2,
+     "metadata": {},
+     "source": [
+      "The Trapezoid Rule"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "We will first look at the Trapezoid method.  This method is implemented by evaluating the function at $n$ points and then computing the areas of the trapezoids defined by a piecewise linear approximation to the original function defined by these points.  In the figure below, we are approximating the integral of the blue curve by the sum of the areas of the red trapezoids."
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "def plot_trap(f,a,b,n):\n",
+      "    x = linspace(a-0.2, b+0.2, 10000) # points for smooth plot\n",
+      "    plot(x,f(x),'b-')\n",
+      "    xj = linspace(a,b,n)\n",
+      "    plot(xj,f(xj),'ro-')\n",
+      "    for xi in xj:\n",
+      "        plot([xi,xi], [0,f(xi)], 'r')\n",
+      "    plot([a,b], [0,0], 'r') # along x-axis\n",
+      "\n",
+      "plot_trap(f1,a1,b1,5)"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "heading",
+     "level": 3,
+     "metadata": {},
+     "source": [
+      "The Trapezoid rule formula"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "The area of a single trapezoid is the width of the base times the average height, so between points $x_j$ and $x_{j+1}$ this gives:\n",
+      "$$ \\frac{h}{2} (f(x_j) + f(x_{j+1}). $$\n",
+      "\n",
+      "Summing this up over all the trapezoids gives:\n",
+      "$$ h\\left(\\frac 1 2 f(x_0) + f(x_1) + f(x_2) + \\cdots + f(x_{n-2}) + \\frac 1 2 f(x_{n-1})\\right) = h\\sum_{j=0}^{n-1} f(x_j) - \\frac h 2 \\left(f(x_0) + f(x_{n-1})\\right) =  h\\sum_{j=0}^{n-1} f(x_j) - \\frac h 2 \\left(f(a) + f(b))\\right). $$\n",
+      "\n",
+      "This can be implemented as follows (note that in Python fj[-1] refers to the last element of fj, and similarly fj[-2] would be the next to last element)."
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "def trapezoid(f,a,b,n):\n",
+      "    h = (b-a)/(n-1)\n",
+      "    xj = linspace(a,b,n)\n",
+      "    fj = f(xj)\n",
+      "    int_trapezoid = h*sum(fj) - 0.5*h*(fj[0] + fj[-1])\n",
+      "    return int_trapezoid\n"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "We can test it out for the points used in the figure above:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "n = 5\n",
+      "int_trap = trapezoid(f1,a1,b1,n)\n",
+      "error = abs(int_trap - int_true1)\n",
+      "print \"trapezoid rule approximation: %22.14e,  error: %10.3e\" % (int_trap, error)"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Using more points will give a better approximation, try changing it in the cell above."
+     ]
+    },
+    {
+     "cell_type": "heading",
+     "level": 3,
+     "metadata": {},
+     "source": [
+      "Convergence tests"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "If we increase n, the number of points used, and hence decrease h, the spacing between points, we expect the error to converge to zero for reasonable functions $f(x)$.\n",
+      "\n",
+      "The trapezoid rule is \"second order accurate\", meaning that the error goes to zero like $O(h^2)$ for a function that is sufficiently smooth (for example if its second derivative is continuous).  For small $h$, the error is expected to be behave like $Ch^2 + O(h^3)~$ as $h$ goes to zero, where $C$ is some constant that depends on how smooth $h$ is.  \n",
+      "\n",
+      "If we double n (and halve h) then we expect the error to go down by a factor of 4 roughly (from $Ch^2$ to $C(h/2)^2~$).\n",
+      "\n",
+      "We can check this by trying several values of n and making a table of the errors and the ratio from one n to the next:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "def error_table(f,a,b,nvals,int_true,method=trapezoid):\n",
+      "    \"\"\"\n",
+      "    An improved version that takes the function defining the method as an\n",
+      "    input argument.\n",
+      "    \"\"\"\n",
+      "    print \"      n         approximation        error       ratio\"\n",
+      "    last_error = 0.  # need something for first ratio\n",
+      "    for n in nvals:\n",
+      "        int_approx = method(f,a,b,n)\n",
+      "        error = abs(int_approx - int_true)\n",
+      "        ratio = last_error / error\n",
+      "        last_error = error # for next n\n",
+      "        print \"%8i  %22.14e  %10.3e  %10.3e\" % (n,int_approx, error, ratio)\n",
+      "    \n",
+      "nvals = array([5, 10, 20, 40, 80, 160, 320])\n",
+      "error_table(f1,a1,b1,nvals,int_true1,trapezoid)"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "(Note that the first ratio reported is meaningless.)\n",
+      "\n",
+      "Convergence might be easier to see in a plot.  If a method is p'th order accurate then we expect the error to behave like $E\\approx Ch^p$ for some constant $C$, for small $h$.  This is hard to visualize.  It is much easier to see what order accuracy we are achieving if we produce a log-log plot instead, since $E = Ch^p~$ means that $\\log E = \\log C + p\\log h$ \n",
+      "\n",
+      "In other words $\\log E~$ is a linear function of $\\log h~$."
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "def error_plot(f,a,b,nvals,int_true,method=trapezoid):\n",
+      "    errvals = zeros(nvals.shape)  # initialize to right shape\n",
+      "    for i in range(len(nvals)):\n",
+      "        n = nvals[i]\n",
+      "        int_approx = method(f,a,b,n)\n",
+      "        error = abs(int_approx - int_true)\n",
+      "        errvals[i] = error\n",
+      "    hvals = (b - a) / (nvals - 1)  # vector of h values for each n\n",
+      "    loglog(hvals,errvals, 'o-')\n",
+      "    xlabel('spacing h')\n",
+      "    ylabel('error')\n",
+      "    \n",
+      "error_plot(f1,a1,b1,nvals,int_true1,trapezoid)"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "heading",
+     "level": 3,
+     "metadata": {},
+     "source": [
+      "An oscillatory function"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "If the function $f(x)$ is not as smooth (has larger second derivative at various places) then the accuracy with a small number of points will not be nearly as good.  For example, consider the function $f_2(x) = 1 + x^3 + \\sin(kx)~~~$ where $k$ is a parameter.  For large $k$ this function is very oscillatory.  In order to experiment with different values of $k$, we can define a \"function factory\" that creates this function for any given $k$, and also returns the true integral over a given interval:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "def f2_factory(k, a, b):\n",
+      "    def f2(x):\n",
+      "        return 1 + x**3 + sin(k*x)\n",
+      "    int_true = (b-a) + (b**4 - a**4) / 4. - (1./k) * (cos(k*b) - cos(k*a))\n",
+      "    return f2, int_true\n",
+      "    "
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "First create a version of $f_2$ with $k=50$:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "k = 50.\n",
+      "a2 = 0.\n",
+      "b2 = 2.\n",
+      "f2, int_true2 = f2_factory(k, a2, b2)\n",
+      "print \"true integral: %22.14e\" % int_true2"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "For this function with k=50, using n=10 points is not going to give a very good approximation:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "plot_trap(f2,a2,b2,10)"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "This doesn't look very good, but for larger values of $n$ we still see the expected convergence rate:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "error_plot(f2,a2,b2,nvals,int_true2)"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Now make the function much more oscillatory with a larger value of $k$..."
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "k = 1000.\n",
+      "f2, int_true2 = f2_factory(k,a2,b2)\n",
+      "print \"true integral: %22.14e\" % int_true2"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "For the previous choice of nvals the method does not seem to be doing well:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "nvals = array([5, 10, 20, 40, 80, 160, 320])\n",
+      "print \"nvals = \",nvals\n",
+      "error_plot(f2,a2,b2,nvals,int_true2, trapezoid)"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "In this case the $O(h^2)~$ behavior does not become apparent unless we use much smaller $h$ values so that we are resolving the oscillations:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "nvals = array([5 * 2**i for i in range(12)])\n",
+      "print \"nvals = \",nvals\n",
+      "error_plot(f2,a2,b2,nvals,int_true2,trapezoid)"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Eventually we see second order convergence and ratios that approach 4:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "error_table(f2,a2,b2,nvals,int_true2,trapezoid)"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "heading",
+     "level": 2,
+     "metadata": {},
+     "source": [
+      "Simpson's Rule"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "There are much better methods than the Trapezoidal rule that are not much harder to implement but get much smaller errors with the same number of function evaluations. One such method is Simpson\u2019s rule, which approximates the integral over a single interval from $x_i$ to $x_{i+1}$ by\n",
+      "$$\\int_{x_i}^{x_{i+1}} f(x)\\, dx \\approx \\frac h 6 (f(x_i) + 4f(x_{i+1/2}) + f(x_{i+1})),$$\n",
+      "where $x_{i+1/2} = \\frac 1 2 (x_i + x_{i+1}) = x_i + h/2.$\n",
+      "\n",
+      "Derivation: The trapezoid method is derived by approximating the function on each interval by a linear function interpolating at the two endpoints of each interval and then integrating this linear function.  Simpson's method is derived by approximating the function by a quadratic function interpolating at the endpoints and the center of the interval and integrating this quadratic function."
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Adding this up over $n-1$  intervals gives the approximation\n",