Back to Notes

LECTURE 9 (09/30/00)


9. Numerical integration

      9.0 	Def:
		Upper sum
		Lower sum

      9.1	Rectangular rules
	Use either lower sum or upper sum.
	Accuracy: O(h) where h is the width of the rectangles.

      9.2	Trapezoid rules
	Use the average of both sums.
	Accuracy:  where h is the width of the Trapezoid.

      9.3	Curve Fitting
	Basic ideas of Least Square:
		{ } is a set of n data points,
		we wish to fit these points through a straight line
		y = b0 + b1 x
	How do we find the coefficients b0 and b1?
	--We minimize the error of the points from the curves at the data points supplied

	we need to take derivatives wrt b0 and b1, we get two equations

     
	We can solve these two equations for b0 and b1.
	example
		i=1 	12	4
		i=2	11	3
		i=3	10	2
		i=4	9	0
		i=5	8	1
	Obvious	solution: y = -8 + 1.0 x (total error  = 2.0).
	LS solution:            y = -7 + 0.9 x (total error  = 1.9).
	This LS will guarantee the lowest error.


10. ODEs
	Initial value problems.
		u' = f(t, u)
	               
	What's the solution of	 ?
		answer: 		
	Now, what's differential equation?
	Large number of ODEs don't have closed-form solutions.
	e.g.,		
	        with u(0) = 0.
	What do you mean by numerical solution of ODEs?
		Finding the points  such that
			
		Of course we still don't know what function u(t) is.

	10.1. Euler's method
	Solve 
		u' = f(t, u)	t in [a,b]
	               
	We split the interval [a,b] into M equal "meshes/steps/blocks",
	the size of each mesh (step size/mesh size/block size) is
		          h = (b-a)/M
	a mesh point:

	Thus,	(using graph)

	Using Taylor expansion, we get

	   
	We can set  because h^2 is small, thus
    
	i.e.

	We know

	Thus, 
  .
	k = 0, 
.
	k = 1, 
.
	... ...

	It's only a first order method accurate up to "h"
	Example,
		You have $1000 in bank making 10% interest per year.
	What's the total amount of money you will get in 5 Years?
		u(t) = $ at time t, so u(0) = 1000
		R = interest = 10%
	Money increase rate:
		u'(t) = R u(t)
	Using Euler's method, we get

   
    
       
			    ... ...
      
	i.e., 
 
	The money at year 5:
	if we choose h = 1 (step size=1 year), M=5
    
	if we choose h = 1/12 (step size=1 month), M=60
       
	if we choose h = 1/360 (step size=1 day), M=1800
          
	One looses $38 if compuned yearly instead of daily.

Last Modified: 10/08/00