This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Lecture 20 – November 4, 2010 Agenda: • Exam 2 recap • More on numerical integration of functions Multiple integrals • Numerical differentiation “High accuracy” finite difference formulas Derivatives of unequally spaced data Numerical differentiation in MATLAB Exam 2 Results Multiple Integrals • We can also integrate functions numerically with respect to two or more dimensions; a 2D integral would be: • Consider an example of an analytical indefinite integral: • This sequential approach is also used for definite integrals: dxdy y x f ) , ( 2 1 2 2 4 1 2 2 1 C y C y x dy C y x dxdy xy 4 1 2 4 1 2 4 1 1 2 1 1 2 2 1 2 2 1 1 1 1 1 dy y dy y y dxdy xy Multiple Integrals • Let’s look at the 2D function we are trying to integrate: >> f = @(x,y) x*y >> x = [0:.1:1]'; >> y = x'; >> z = f(x,y); >> surf(x,y,z) Multiple Integrals • We can use the trapezoidal rule (twice) to integrate this function numerically (and exactly?): • Alternatively, we can use the 2D version of the quad function in MATLAB ( dblquad ): • We can also evaluate the integral analytically using int : >> xint = trapz(x,z); >> xyint = trapz(y,xint) xyint = 0.2500 >> dblquad(f,0,1,0,1) ans = 0.2500 >> syms x y; >> int(int(x*y,x,0,1),y,0,1) ans = 1/4 Taylor Series: Estimating Derivatives • The Taylor Series can be used to estimate derivatives by virtue of its definition • Before we consider how this is possible, let’s consider the Taylor Series for a function f ( x ) where we know its value at a point x i , but we don’t know its value some arbitrary increment h “forward” at x i +1 • Expand around x i to define f ( x i +1 ): • What does this look like graphically? 4 3 2 1 6 2 h O h x f h x f h x f x f x f i i i i i • The estimates for f ( x i+1 ) improve with each term in the series • Nothing new here yet, we’ve seen this with the previous examples Taylor Series: Estimating Derivatives 2 1 h O h x f x f x f i i i Taylor Series: Estimating Derivatives • Let’s take a closer look at the first order form of the TSE: • If we’d like an estimate of the function’s derivative, we could use the truncated TSE to solve for the first derivative: • Graphically: h O h x f x f x f i i i 1 Taylor Series: Estimating Derivatives...
View
Full Document
 Spring '08
 Staff
 Numerical Analysis, Derivative, finite difference

Click to edit the document details