CS 221. Tuesday 8 November 2011



Similar documents
Nonlinear Algebraic Equations Example

4.3 Lagrange Approximation

Solutions of Equations in One Variable. Fixed-Point Iteration II

x 2 + y 2 = 1 y 1 = x 2 + 2x y = x 2 + 2x + 1

Aim. Decimal Search. An Excel 'macro' was used to do the calculations. A copy of the script can be found in Appendix A.

The Method of Least Squares. Lectures INF2320 p. 1/80

Math 113 HW #7 Solutions

Separable First Order Differential Equations

Mathematics Pre-Test Sample Questions A. { 11, 7} B. { 7,0,7} C. { 7, 7} D. { 11, 11}

6.4 Logarithmic Equations and Inequalities

Algebra Unpacked Content For the new Common Core standards that will be effective in all North Carolina schools in the school year.

Review of Fundamental Mathematics

This unit will lay the groundwork for later units where the students will extend this knowledge to quadratic and exponential functions.

Linearly Independent Sets and Linearly Dependent Sets

1 Review of Least Squares Solutions to Overdetermined Systems

The Method of Partial Fractions Math 121 Calculus II Spring 2015

Airport Planning and Design. Excel Solver

Readings this week. 1 Parametric Equations Supplement. 2 Section Sections Professor Christopher Hoffman Math 124

Representation of functions as power series

Solving Quadratic Equations

Roots of Equations (Chapters 5 and 6)

MATHEMATICS FOR ENGINEERING BASIC ALGEBRA

Polynomial and Rational Functions

Numerical Methods for Differential Equations

FREE FALL. Introduction. Reference Young and Freedman, University Physics, 12 th Edition: Chapter 2, section 2.5

Roots of equation fx are the values of x which satisfy the above expression. Also referred to as the zeros of an equation

1.7. formulae and transposition. Introduction. Prerequisites. Learning Outcomes. Learning Style

ALGEBRA 2/TRIGONOMETRY

Method To Solve Linear, Polynomial, or Absolute Value Inequalities:

Student Outcomes. Lesson Notes. Classwork. Exercises 1 3 (4 minutes)

Slope and Rate of Change

Grade level: secondary Subject: mathematics Time required: 45 to 90 minutes

Math Placement Test Practice Problems

CURVE FITTING LEAST SQUARES APPROXIMATION

1 Lecture: Integration of rational functions by decomposition

DIFFERENTIABILITY OF COMPLEX FUNCTIONS. Contents

MATH 60 NOTEBOOK CERTIFICATIONS

Inner Product Spaces

Practice Final Math 122 Spring 12 Instructor: Jeff Lang

Geometric Optics Converging Lenses and Mirrors Physics Lab IV

EL-9650/9600c/9450/9400 Handbook Vol. 1

Thermistor Basics. Application Note AN-TC11 Rev. A. May, 2013 Page 1 WHAT IS A THERMISTOR?

General Framework for an Iterative Solution of Ax b. Jacobi s Method

A three point formula for finding roots of equations by the method of least squares

MATH 132: CALCULUS II SYLLABUS

FINAL EXAM SECTIONS AND OBJECTIVES FOR COLLEGE ALGEBRA

Because the slope is, a slope of 5 would mean that for every 1cm increase in diameter, the circumference would increase by 5cm.

An Introduction to Applied Mathematics: An Iterative Process

Algebra II End of Course Exam Answer Key Segment I. Scientific Calculator Only

SOLVING TRIGONOMETRIC INEQUALITIES (CONCEPT, METHODS, AND STEPS) By Nghi H. Nguyen

Rootfinding for Nonlinear Equations

Thermistor Calibration: T = F(R)

Lecture 3: DC Analysis of Diode Circuits.

Objectives. Materials

Microeconomic Theory: Basic Math Concepts

2013 MBA Jump Start Program

3.3 Real Zeros of Polynomials

Chapter 6 Work and Energy

Math Numerical Analysis Homework #2 Solutions

The KaleidaGraph Guide to Curve Fitting

EQUATIONS and INEQUALITIES

ax 2 by 2 cxy dx ey f 0 The Distance Formula The distance d between two points (x 1, y 1 ) and (x 2, y 2 ) is given by d (x 2 x 1 )

CHAPTER FIVE. Solutions for Section 5.1. Skill Refresher. Exercises

NTC Thermistor theory TABLE OF CONTENTS

DERIVATIVES AS MATRICES; CHAIN RULE

Solutions to Homework 5

CHAPTER 5 Round-off errors

Functions: Piecewise, Even and Odd.

Pressure in Fluids. Introduction

Correlation. What Is Correlation? Perfect Correlation. Perfect Correlation. Greg C Elvers

CHAPTER 2. Eigenvalue Problems (EVP s) for ODE s

Solutions to Homework 10

Homework # 3 Solutions

Integration of a fin experiment into the undergraduate heat transfer laboratory

1 Review of Newton Polynomials

1.7 Graphs of Functions

The Distance Formula and the Circle

Experiment #1, Analyze Data using Excel, Calculator and Graphs.

Partial Fractions. Combining fractions over a common denominator is a familiar operation from algebra:

3 e) x f) 2. Precalculus Worksheet P Complete the following questions from your textbook: p11: # Why would you never write 5 < x > 7?

You must have: Ruler graduated in centimetres and millimetres, protractor, compasses, pen, HB pencil, eraser, calculator. Tracing paper may be used.

Problem Set V Solutions

G.A. Pavliotis. Department of Mathematics. Imperial College London

DRAFT. Algebra 1 EOC Item Specifications

Eigenvalues, Eigenvectors, and Differential Equations

*X100/12/02* X100/12/02. MATHEMATICS HIGHER Paper 1 (Non-calculator) MONDAY, 21 MAY 1.00 PM 2.30 PM NATIONAL QUALIFICATIONS 2012

Examples of Functions

FRICTION, WORK, AND THE INCLINED PLANE

Thursday 8 November 2012 Afternoon

Math Common Core Sampler Test

Session 7 Bivariate Data and Analysis

Tuesday 6 November 2012 Morning

A power series about x = a is the series of the form

Solving Equations and Inequalities

1 Error in Euler s Method

QUADRATIC EQUATIONS EXPECTED BACKGROUND KNOWLEDGE

APPLIED MATHEMATICS ADVANCED LEVEL

Algebra. Exponents. Absolute Value. Simplify each of the following as much as possible. 2x y x + y y. xxx 3. x x x xx x. 1. Evaluate 5 and 123

Transcription:

CS 221 Tuesday 8 November 2011

Agenda 1. Announcements 2. Review: Solving Equations (Text 6.1-6.3) 3. Root-finding with Excel ( Goal Seek, Text 6.5) 4. Example Root-finding Problems 5. The Fixed-point root-finding method 6. Error estimation in numerical methods 7. Review: Matrix Mathematics (Text Ch. 7) 8. Matrix Operations in MATLAB & Excel (Ch. 7)

1. Announcements Problem Set 4 out tonight, due Wed 16 Nov Root-finding problems Next Quiz: in Class, two weeks from today: Tuesday, 22 November

2. Review: Solving Equations Step one: get the equation into the form: f(x) = 0 Step two: determine what is the form of f(x) Step three: solve accordingly Linear: use algebra Nonlinear - polynomial MATLAB: use roots() preferred: gives all roots Excel: use Goal Seek Nonlinear - general MATLAB: use fzero() Excel: use Goal Seek

Determine the Form of f(x) Does f(x) contain powers of x higher than 1, or transcendental functions like cos, sin, exp, log, etc.? no: linear yes: see below Does f(x) contain noninteger powers of x, or transcendentals? no: nonlinear/polynomial yes: nonlinear/general

3 Root-Finding with Excel (Text Section 6.5) Simple tool: Goal Seek capability Tells Excel to vary the value of a cell containing the independent variable until value of the cell containing the function (dependent variable) is equal to a given value Steps: 1. Identify one cell to hold the value of the independent variable (call it x) 2. Fill in another cell with the formula for f(x) 3. Put an initial estimate of the root in the first cell 4. Select the goal seek function and set the target value to 0.

Goal Seek Example

Goal Seek Example

Use the MATLAB roots() function to solve polynomials. Because f(x) is a polynomial in this example, is easily solved in this way Create a vector for the coefficients of the polynomial: c = [ 3, -15, -20, 50 ]; Pass it to roots(): roots(c) Result is a column vector containing all roots of the polynomial real and complex

4. Example Problems Thermistors are resistors (electrical components) whose resistance varies with temperature, according to the Steinhart-Hart equation: 1/(T + 273.15) = C 1 + C 2 ln(r) + C 3 ln 3 (R) What resistance (in ohms) corresponds to a temperature of 15 C, if C 1 = 1.1E-3, C 2 = 2.3E-4, and C 3 =8.2E-8?

Get the Equation into the Right Form We are solving for R, so we want f(r) = 0: 1/(T + 273.15) = 1.1E-3 + 2.3E-4*log(R) + 8.2E-8*log(R)^3 1.1E-3 + 2.3E-4*log(R) + 8.2E-8*log(R)^3 (1/(T+273.15)) = 0 Use plotting tools (fplot) to determine the neighborhood of the root.

Example You are designing a water tank for a village in Africa. The tank is spherical, with a radius R meters. The volume of water it holds if filled to height h is given by: V = h 2 (3R-h)/3 To what height must the tank be filled to hold 30 m 3 of water?

Another Example Problem Consider a steam pipe of length L=25m and diameter d=0.1m. The pipe loses heat to the ambient air and surrounding surfaces by convection and radiation.

Another Example Problem The relationship between the surface temperature of the pipe, T S, and the total flow of heat per unit time, Q, is: Q = dl[h(t S T air ) + SB (T 4 S T 4 sur )]

Another Example Problem Where: h = 10 W/m 2 /K = 0.8 SB = 5.67 x 10-8 = Stefan-Bolzmann Constant T air = T sur = 298K If Q = 18405 W, what is the surface temperature (T S ) of the pipe? dl[h(t S T air ) + SB (T 4 S T 4 sur )] Q = 0

5. The Fixed-Point Method of Finding Roots (note: not in your text) A value x is a fixed-point of function g(x) iff g(x) = x Two basic concepts: 1. Rewriting an equation f(x) = 0 into fixed-point form: g(x) = x 2. Iterative method of finding a fixed point: while x i x i+1 x i+1 = g(x i ) end Actually, we will use x i x i+1 >

Rewriting Equations We need to rewrite so that f(x) = 0 if g(x) = x If f(x) contains an x term, rearrange to get it on one side: Example: x 2 2x 3 = 0 becomes (x 2 3)/2 = x Or, you can always just add x to both sides: f(x) = 0 if f(x) + x = x, so take g(x) = f(x) + x Example: x 2 2x 3 = 0 x 2 2x 3 + x = x x 2 x 3 = x

Rewriting Equations Do I hear you saying Wait a minute... In that example, f(x) = x 2 2x 3 = 0, the two methods yield two different g(x) s! g(x) = (x 2 3)/2 and g(x) = x 2 x 3 What gives??!!

Answer: Both g(x) s work

Rewriting Equations Goal: find x such that f(x) = 0. We are transforming this into the problem of finding x such that x = g(x) In such a way that f(x) = 0 for any such x There may be more than one g(x) for which this relationship holds! Graphically: we are looking for the intersection between the curves y = x and y = g(x)

The Iterative Method is Simple! Main loop: set x 0 = an estimate of the root While error estimate is too big: set x i+1 = g(x i ); update error estimate; end Approximate relative error estimate: a = (x i+1 x i )/x i+1

Convergence and Divergence Graphical depiction of the fixed-point method

Convergence and Divergence The fixed-point method is not guaranteed to converge

Convergence and Divergence The fixed-point method is not guaranteed to converge

Convergence and Divergence The fixed-point method is not guaranteed to converge

Convergence of Fixed-Point Iteration Convergence is determined by the magnitude of the slope: g(x i+1 ) g(x i ) x i+1 x i If slope < 1 then g(x i+1 ) will be closer to the fixed point than g(x i ) (the error decreases) Else g(x i+1 ) does not approach the fixed point (error increases or stays the same)

6. Error Estimation in Numerical Methods Numerical methods yield approximate results As engineers, we need to understand the sources of error in our results Round-off or truncation errors E.g., using 3.14 for pi Computational methods Order of operations can make a difference Rewrite formulas to avoid operations whose operands have very different magnitudes Inputs (e.g., measurements) Approximations of functions (Mont Blanc tunnel)

Definitions True value = approximation + error or: E t = true value approximation ( true error ) Note: requires knowledge of true value! t = E t /true value ( true relative error, usually given as a percentage) Example: measure a city block: 9999 cm True value: 10000 cm measure a pencil: 9 cm True value: 10 cm Error is 1 cm in both cases! Relative errors are very different: 0.01% vs 10%

Error Estimation When we use numerical methods, we usually don t know the true value! We are computing an approximation, and would like to know how close we are to the real value Typically we have to estimate the error as well! Best-effort approach: a = approximate error/approximate value ( approximate relative error ) For iterative methods: a = (current estimate previous estimate)/current estimate A bound s on the error may be specified as part of the problem Iterate until a < s

7. Review: Matrix Mathematics