Question? Leave a message!




Mathematics and engineering

Mathematics and engineering
Dr.SethPatton Profile Pic
Dr.SethPatton,United Kingdom,Teacher
Published Date:22-07-2017
Website URL
Comment
ECE 250 Algorithms and Data Structures Mathematical background Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada ece.uwaterloo.ca dwharderalumni.uwaterloo.ca © 2006-2013 by Douglas Wilhelm Harder. Some rights reserved.Mathematical background 2 Outline This topic reviews the basic mathematics required in this course: – A justification for a mathematical framework – The ceiling and floor functions – L’Hôpital’s rule – Logarithms – Arithmetic and other polynomial series • Mathematical induction – Geometric series – Recurrence relations – Weighted averages – CombinationsMathematical background 3 Mathematics and engineering For engineers, mathematics is a tool: – Of course, that doesn’t mean it always works... http://xkcd.com/55/Mathematical background 4 Justification However, as engineers, you will not be paid to say: Method A is better than Method B or Algorithm A is faster than Algorithm B Such comparisons are said to be qualitative: qualitative, a. Relating to, connected or concerned with, quality or qualities. Now usually in implied or expressed opposition to quantitative. OEDMathematical background 5 Justification Qualitative statements cannot guide engineering design decisions: – Algorithm A could be better than Algorithm B, but Algorithm A would require three person weeks to implement, test, and integrate while Algorithm B has already been implemented and has been used for the past year – There are circumstances where it may beneficial to use Algorithm A, but not based on the word betterMathematical background 6 Justification Thus, we will look at a quantitative means of describing data structures and algorithms: quantitative, a. Relating to, concerned with, quantity or its measurement; ascertaining or expressing quantity. OED This will be based on mathematics, and therefore we will look at a number of properties which will be used again and again throughout this courseMathematical background 7 Floor and ceiling functions The floor function maps any real number x onto the greatest integer less than or equal to x: 3.2 3 3   5.266   – Consider it rounding towards negative infinity The ceiling function maps x onto the least integer greater than or equal to x: 3.2 4 4   Necessary because double 1024 have a range just under 2 5.255   – Consider it rounding towards positive infinity long can only represent – The cmath library implements these as 63 numbers as large as 2 – 1 double floor( double ); double ceil( double );Mathematical background 8 L’Hôpital’s rule If you are attempting to determine fn  lim n  gn  lim f n lim g n but both , it follows  nn 1  f n f n  lim lim 1  nn gn  gn  Repeat as necessary… k  th fn Note: the k derivative will always be shown as Mathematical background 9 Logarithms We will begin with a review of logarithms: m If n = e , we define m = ln( n ) ln(n) n It is always true that e = n; however, ln(e ) = n requires that n is realMathematical background 10 Logarithms Exponentials grow faster than any non-constant polynomial n e lim  d n  n for any d 0 Thus, their inverses—logarithms—grow slower than any polynomial ln(n) lim 0 d n  nMathematical background 11 Logarithms 1/2 Example: is strictly greater than ln(n) f() n n n n ln(n)Mathematical background 12 Logarithms 1/3 3 grows slower but only up to n = 93 f() n n n (93.354, 4.536) ln(n) 3 nMathematical background 13 Logarithms You can view this with any polynomial ln(n) 4 n (5503.66, 8.61)Mathematical background 14 Logarithms We have compared logarithms and polynomials – How about log (n) versus ln(n) versus log (n) 2 10 You have seen the formula Constant ln(n) log (n) b ln(b) All logarithms are scalar multiples of each othersMathematical background 15 Logarithms A plot of log (n) = lg(n), ln(n), and log (n) 2 10 lg(n) ln(n) log (n) 10Mathematical background 16 Logarithms Note: the base-2 logarithm log (n) is written as lg(n) 2 It is an industry standard to implement the natural logarithm ln(n) as double log( double ); The common logarithm log (n) is implemented as 10 double log10( double );Mathematical background 17 Logarithms A more interesting observation we will repeatedly use: log (m) log (n) b b n = m , log n b nb a consequence of : log (m) log (n) log (m) b b b n = (b ) log (n) log (m) b b = b log (m) log (n) b b = (b ) log (n) b = mMathematical background 18 Logarithms You should also, as electrical or computer engineers be aware of the relationship: 10 lg(2 ) = lg(1024) = 10 20 lg(2 ) = lg(1 048 576) = 20 and consequently: 3 lg(10 ) = lg(1000) ≈ 10 kilo 6 lg(10 ) = lg(1 000 000) ≈ 20 mega 9 lg(10 ) ≈ 30 giga 12 lg(10 ) ≈ 40 teraMathematical background 19 Arithmetic series Next we will look various series Each term in an arithmetic series is increased by a constant value (usually 1) : n nn1  01 2 3nk  2 k0Mathematical background 20 Arithmetic series Proof 1: write out the series twice and add each column . . . 1 + 2 + 3 + + n – 2 + n – 1 + n . . . + n + n – 1 + n – 2 + + 3 + 2 + 1 . . . (n + 1) + (n + 1) + (n + 1) + + (n + 1) + (n + 1) + (n + 1) = n (n + 1) Since we added the series twice, we must divide the result by 2