MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.

Slides:



Advertisements
Similar presentations
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Advertisements

ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Limits and an Introduction to Calculus
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Laplace Transform Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2008 by Douglas Wilhelm Harder.
11 The student will learn about: §4.3 Integration by Substitution. integration by substitution. differentials, and.
Differentiation and Richardson Extrapolation
Topics in Applied Mathematics Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Boundary-value Problems and Finite-difference Equations Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University.
Laplace’s Equation in 2 and 3 Dimensions Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Tort Law: Negligence Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
Shortest Paths Introduction to Algorithms Shortest Paths CSE 680 Prof. Roger Crawfis.
Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada ece.uwaterloo.ca.
The Wave Equation Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
The Shooting Method for Boundary-value Problems
WATERLOO ELECTRICAL AND COMPUTER ENGINEERING Intellectual Property 1 WATERLOO ELECTRICAL AND COMPUTER ENGINEERING Intellectual Property Douglas Wilhelm.
Fixed-Point Iteration Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm.
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Welcome to ECE 204 Numerical Methods for Computer Engineers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo.
Chapter 9 Numerical Integration Flow Charts, Loop Structures Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Proof by Induction.
The Crank-Nicolson Method and Insulated Boundaries
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
Scientific Computing Linear Least Squares. Interpolation vs Approximation Recall: Given a set of (x,y) data points, Interpolation is the process of finding.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Binary Numbers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm Harder.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Copyright © Cengage Learning. All rights reserved. 12 Limits and an Introduction to Calculus.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Problems with Floating-Point Representations Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Decimal Numbers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm Harder.
Double-Precision Floating-Point Numbers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007.
The Wave Equation Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada.
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Interpolation Search Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada.
Interpolating Solutions to IVPs Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
1 Introduction In this course, we will look at: –Algorithms for solving problems efficiently –Data structures for efficiently storing, accessing, and modifying.
WATERLOO ELECTRICAL AND COMPUTER ENGINEERING Complaints, Discipline and Enforcement 1 WATERLOO ELECTRICAL AND COMPUTER ENGINEERING Professional Engineers.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
1 The tree data structure Outline In this topic, we will cover: –Definition of a tree data structure and its components –Concepts of: Root, internal, and.
© 2010 Pearson Education Inc.Goldstein/Schneider/Lay/Asmar, CALCULUS AND ITS APPLICATIONS, 12e– Slide 1 of 33 Chapter 3 Techniques of Differentiation.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
1 N -ary trees This topic quickly looks at a generalization of a binary tree, where each node has up to N children –Definition –Perfect N -ary trees –Complete.
1 Binary trees Outline In this talk, we will look at the binary tree data structure: –Definition –Properties –A few applications Ropes (strings) Expression.
1 Complete binary trees Outline Introducing complete binary trees –Background –Definitions –Examples –Logarithmic height –Array storage.
Open Addressing: Quadratic Probing
AVL Trees.
Outline Introducing perfect binary trees Definitions and examples
Boundary-value problems and Finite-difference equations
Presentation transcript:

MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011 by Douglas Wilhelm Harder. All rights reserved. Advanced Calculus 2 for Electrical Engineering Advanced Calculus 2 for Nanotechnology Engineering 1-D Finite-Element Methods with Tent Test Functions

1-D Finite-element Methods with Tent Test Functions 2 Outline This topic discusses an introduction to finite-element methods –Background –Define tent-shaped test functions –Perform integration-by-parts to get the linear equation Approximate the solution by a linear solution Find the system of equations

1-D Finite-element Methods with Tent Test Functions 3 Outcomes Based Learning Objectives By the end of this laboratory, you will: –Understand the use of test functions in one dimension –Understand how to create a system of linear equations using these test functions in one dimenion

1-D Finite-element Methods with Tent Test Functions 4 The Target Equation At this point, we have generalized the finite-difference method to allow arbitrarily spaced points in one dimension The ultimate goal is to do this in 2 and 3 dimensions –In order to achieve this, we need one further idea

1-D Finite-element Methods with Tent Test Functions 5 Test Functions Up to this point, we have used uniform test functions:

1-D Finite-element Methods with Tent Test Functions 6 Test Functions Two problems: –The impulse function appears in the integrals, and –This will not generalize to two and three dimensions!

1-D Finite-element Methods with Tent Test Functions 7 Test Functions Solution: –Use a tent function

1-D Finite-element Methods with Tent Test Functions 8 Test Functions Defining such functions is straight-forward: If x = x 2, both, if x = x 1,, and if x = x 3,

1-D Finite-element Methods with Tent Test Functions 9 Integration by Parts Now, substitute this test function into the integral: which yields

1-D Finite-element Methods with Tent Test Functions 10 Integration by Parts The tent function disappears at x 1 at x 3 : thus, this simplifies to: 0

1-D Finite-element Methods with Tent Test Functions 11 Integration by Parts The tent function disappears at x 1 at x 3 : thus, this simplifies to: 0 A similar property will be used in 2 and 3 dimensions – remember this fact!

1-D Finite-element Methods with Tent Test Functions 12 Integration by Parts Recall that both the test function  2 (x) and are defined on :

1-D Finite-element Methods with Tent Test Functions 13 Integration by Parts On the intervals, the derivatives are defined:

1-D Finite-element Methods with Tent Test Functions 14 Integration by Parts Thus:

1-D Finite-element Methods with Tent Test Functions 15 Integration by Parts In general:

1-D Finite-element Methods with Tent Test Functions 16 Integration by Parts Substituting this back into our equation, we get: or, expanding the left-hand side:

1-D Finite-element Methods with Tent Test Functions 17 Integration by Parts In the special case that is a constant, this simplifies further:

1-D Finite-element Methods with Tent Test Functions 18 The Test Functions The function to find the approximations is straight-forward: function [ v ] = uniform1d( x, uab, rho ) n = length( x ) - 2; idx = 1./diff(x); M = diag( -(idx( 1:end - 1 ) + idx( 2: end )) ) +... diag( idx( 2:end - 1 ), -1 ) +... diag( idx( 2:end - 1 ), +1 ); b = zeros ( n, 1 ); for k = 1:n b(k) = int( rho, x(k), x(k + 1), x(k + 2) ); end b(1) = b(1) - idx(1)*uab(1); b(end) = b(end) - idx(end)*uab(end); v = [uab(1); M \ b; uab(2)]; end int( rho, a, b ) approximates

1-D Finite-element Methods with Tent Test Functions 19 The Test Functions In Matlab, recall that we may evaluate functions at a vector of points: –Let a, b, c be the points x = linspace( a, c, n ); rhox = rho( x ).*((x = b).*(x – c)/(b – c));

1-D Finite-element Methods with Tent Test Functions 20 The Test Functions For example, we get the following graph with this Matlab code: >> a = 1; b = 2; c = 5; >> x = linspace( a, c, 100 ); >> tentx = (x = b).*(x - c)/(b – c); >> cosx = cos(x).*tentx; >> hold on >> plot( x, cosx, 'b' ); >> plot( x, cos(x), 'r' ); >> plot( x, tentx, 'm' );

1-D Finite-element Methods with Tent Test Functions 21 The Test Functions Using the exact same example from the last uniform case: >> x_uneq = [ ]'; >> u_uniform = uniform1d( x_uneq, [0, ); >> u_tent = tent1d( x_uneq, [0, ); >> plot( x_uneq, u_uniform, 'b+' ); >> hold on >> plot( x_uneq, u_tent, 'rx' );

1-D Finite-element Methods with Tent Test Functions 22 The Test Functions To demonstrate that this is better than the previous approximation: >> plot( x_uneq, u_uniform - u(x_uneq), 'b+' ); >> plot( x_uneq, u_tent - u(x_uneq), 'rx' ); >> norm( u_uniform - u(x_uneq) ) ans = >> norm( u_tent - u(x_uneq) ) ans = e-011 Recall that the function u(x) is the exact solution 8 × 10 –4 –1.8 × 10 –11

1-D Finite-element Methods with Tent Test Functions 23 Summary In this topic, we have used tent-shaped test functions as opposed to uniform test functions –The integration-by-parts was simpler We avoided the end points as they were zero No impulse functions… –More work is required for the code –Better solution for our example

1-D Finite-element Methods with Tent Test Functions 24 What’s Next? We will next look at how we can extend this to two dimensions –Use triangles to divide up the region instead of intervals Tessellations –Approximate the solution using interpolating polynomials Intervals Tessellation

1-D Finite-element Methods with Tent Test Functions 25 References [1]Glyn James, Advanced Modern Engineering Mathematics, 4 th Ed., Prentice Hall, 2011, §§9.2-3.

1-D Finite-element Methods with Tent Test Functions 26 Usage Notes These slides are made publicly available on the web for anyone to use If you choose to use them, or a part thereof, for a course at another institution, I ask only three things: –that you inform me that you are using the slides, –that you acknowledge my work, and –that you alert me of any mistakes which I made or changes which you make, and allow me the option of incorporating such changes (with an acknowledgment) in my set of slides Sincerely, Douglas Wilhelm Harder, MMath