EVALUATING A POLYNOMIAL



Similar documents
4.5 Chebyshev Polynomials

4.3 Lagrange Approximation

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

Zeros of a Polynomial Function

1 Review of Newton Polynomials

PUTNAM TRAINING POLYNOMIALS. Exercises 1. Find a polynomial with integral coefficients whose zeros include

Zeros of Polynomial Functions

JUST THE MATHS UNIT NUMBER 1.8. ALGEBRA 8 (Polynomials) A.J.Hobson

Lies My Calculator and Computer Told Me

INTERPOLATION. Interpolation is a process of finding a formula (often a polynomial) whose graph will pass through a given set of points (x, y).

2.4 Real Zeros of Polynomial Functions

The Factor Theorem and a corollary of the Fundamental Theorem of Algebra

MA107 Precalculus Algebra Exam 2 Review Solutions

Integrals of Rational Functions

Roots of Polynomials

3.2 The Factor Theorem and The Remainder Theorem

College Algebra - MAT 161 Page: 1 Copyright 2009 Killoran

November 16, Interpolation, Extrapolation & Polynomial Approximation

Lecture Notes on Polynomials

The Method of Partial Fractions Math 121 Calculus II Spring 2015

Pre-Calculus II Factoring and Operations on Polynomials

1 if 1 x 0 1 if 0 x 1

5.3 Improper Integrals Involving Rational and Exponential Functions

Real Roots of Univariate Polynomials with Real Coefficients

Homework 2 Solutions

Numerical Solution of Differential

Application. Outline. 3-1 Polynomial Functions 3-2 Finding Rational Zeros of. Polynomial. 3-3 Approximating Real Zeros of.

8 Polynomials Worksheet

a 1 x + a 0 =0. (3) ax 2 + bx + c =0. (4)

Partial Fractions. p(x) q(x)

LIES MY CALCULATOR AND COMPUTER TOLD ME

The Euclidean Algorithm

Linearly Independent Sets and Linearly Dependent Sets

Procedure for Graphing Polynomial Functions

Figure 1.1 Vector A and Vector F

SOLVING POLYNOMIAL EQUATIONS

1.7. Partial Fractions Rational Functions and Partial Fractions. A rational function is a quotient of two polynomials: R(x) = P (x) Q(x).

Graphing Rational Functions

y cos 3 x dx y cos 2 x cos x dx y 1 sin 2 x cos x dx

The Division Algorithm for Polynomials Handout Monday March 5, 2012

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

UNCORRECTED PAGE PROOFS

1 Review of Least Squares Solutions to Overdetermined Systems

Copy in your notebook: Add an example of each term with the symbols used in algebra 2 if there are any.

WARM UP EXERCSE. 2-1 Polynomials and Rational Functions

Rootfinding for Nonlinear Equations

UNIT 5 VOCABULARY: POLYNOMIALS

Differentiation and Integration

THE CALCULUS OF POLYNOMIALS

Partial Fractions: Undetermined Coefficients

Section 3-3 Approximating Real Zeros of Polynomials

Continued Fractions and the Euclidean Algorithm

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

2.5 ZEROS OF POLYNOMIAL FUNCTIONS. Copyright Cengage Learning. All rights reserved.

Zeros of Polynomial Functions

5 Numerical Differentiation

Chapter 7 Uncomputability

Some facts about polynomials modulo m (Full proof of the Fingerprinting Theorem)

Lectures 5-6: Taylor Series

A review of ideas from polynomial rootfinding

PROBLEM SET 6: POLYNOMIALS

Zero: If P is a polynomial and if c is a number such that P (c) = 0 then c is a zero of P.

COMPLEX NUMBERS AND SERIES. Contents

SMT 2014 Algebra Test Solutions February 15, 2014

Polynomials. Dr. philippe B. laval Kennesaw State University. April 3, 2005

Approximating functions by Taylor Polynomials.

An important theme in this book is to give constructive definitions of mathematical objects. Thus, for instance, if you needed to evaluate.

15. Symmetric polynomials

SEQUENCES ARITHMETIC SEQUENCES. Examples

MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.436J/15.085J Fall 2008 Lecture 5 9/17/2008 RANDOM VARIABLES

CONDITIONAL, PARTIAL AND RANK CORRELATION FOR THE ELLIPTICAL COPULA; DEPENDENCE MODELLING IN UNCERTAINTY ANALYSIS

FFT Algorithms. Chapter 6. Contents 6.1

Polynomial and Rational Functions

Math 4310 Handout - Quotient Vector Spaces

9. POLYNOMIALS. Example 1: The expression a(x) = x 3 4x 2 + 7x 11 is a polynomial in x. The coefficients of a(x) are the numbers 1, 4, 7, 11.

Inner Product Spaces

Quotient Rings and Field Extensions

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

Chapter 4. Polynomial and Rational Functions. 4.1 Polynomial Functions and Their Graphs

63. Graph y 1 2 x and y 2 THE FACTOR THEOREM. The Factor Theorem. Consider the polynomial function. P(x) x 2 2x 15.

3.6 The Real Zeros of a Polynomial Function

Solving Quadratic Equations

Previously, you learned the names of the parts of a multiplication problem. 1. a. 6 2 = 12 6 and 2 are the. b. 12 is the

Predicate Logic. Example: All men are mortal. Socrates is a man. Socrates is mortal.

11 Multivariate Polynomials

FIRST YEAR CALCULUS. Chapter 7 CONTINUITY. It is a parabola, and we can draw this parabola without lifting our pencil from the paper.

When factoring, we look for greatest common factor of each term and reverse the distributive property and take out the GCF.

Solutions to Practice Problems for Test 4

Chapter 7 - Roots, Radicals, and Complex Numbers

arxiv:math/ v3 [math.nt] 25 Feb 2006

Lecture 3: Finding integer solutions to systems of linear equations

Numerical integration of a function known only through data points

Zeros of Polynomial Functions

CHAPTER 5 Round-off errors

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

Second Order Linear Nonhomogeneous Differential Equations; Method of Undetermined Coefficients. y + p(t) y + q(t) y = g(t), g(t) 0.

Computational Geometry Lab: FEM BASIS FUNCTIONS FOR A TETRAHEDRON

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

Transcription:

EVALUATING A POLYNOMIAL Consider having a polynomial p(x) =a 0 + a 1 x + a 2 x 2 + + a n x n which you need to evaluate for many values of x. How do you evaluate it? This may seem a strange question, but the answer is not as obvious as you might think. The standard way, written in a loose algorithmic format: poly = a 0 for j =1:n poly = poly + a j x j end

To compare the costs of different numerical methods, we do an operations count, and then we compare these for the competing methods. Above, the counts are as follows: additions : n n(n +1) multiplications : 1+2+3+ + n = 2 This assumes each term a j x j is computed independently of the remaining terms in the polynomial.

Next, do the terms x j recursively: x j = x x j 1 Then to compute n x 2,x 3,...,x no will cost n 1multiplications. Our algorithm becomes poly = a 0 + a 1 x power = x for j =2:n power = x power poly = poly + a j power end The total operations cost is additions : n multiplications : n + n 1=2n 1 When n is evenly moderately large, this is much less than for the first method of evaluating p(x). For example, with n =20,thefirst method has 210 multiplications, whereas the second has 39 multiplications.

We now considered nested multiplication. As examples of particular degrees, write n =2: p(x) =a 0 + x(a 1 + a 2 x) n =3: p(x) =a 0 + x (a 1 + x (a 2 + a 3 x)) n =4: p(x) =a 0 + x (a 1 + x (a 2 + x (a 3 + a 4 x))) These contain, respectively, 2, 3, and 4 multiplications. This is less than the preceding method, which would have need 3, 5, and 7 multiplications, respectively. For the general case, write p(x) =a 0 +x (a 1 + x (a 2 + + x (a n 1 + a n x) )) This requires n multiplications, which is only about half that for the preceding method. For an algorithm, write poly = a n for j = n 1: 1 :0 poly = a j + x poly end With all three methods, the number of additions is n; but the number of multiplications can be dramatically different for large values of n.

NESTED MULTIPLICATION Imagine we are evaluating the polynomial p(x) =a 0 + a 1 x + a 2 x 2 + + a n x n at a point x = z. Thus with nested multiplication p(z) =a 0 +z (a 1 + z (a 2 + + z (a n 1 + a n z) )) We can write this as the following sequence of operations: b n = a n b n 1 = a n 1 + zb n b n 2 =. a n 2 + zb n 1 b 0 = a 0 + zb 1 The quantities b n 1,..., b 0 are simply the quantities in parentheses, starting from the inner most and working outward.

Introduce Claim: q(x) =b 1 + b 2 x + b 3 x 2 + + b n x n 1 p(x) =b 0 +(x z)q(x) ( ) Proof: Simply expand b 0 +(x z) ³ b 1 + b 2 x + b 3 x 2 + + b n x n 1 and use the fact that zb j = b j 1 a j 1, j =1,...,n With this result (*), we have p(x) x z = b 0 x z + q(x) Thus q(x) is the quotient when dividing p(x) byx z, and b 0 is the remainder.

If z is a zero of p(x), then b 0 =0;andthen p(x) =(x z)q(x) For the remaining roots of p(x), we can concentrate on finding those of q(x). In rootfinding for polynomials, this process of reducing the size of the problem is called deflation. Another consequence of (*) is the following. Form the derivative of (*) with respect to x, obtaining p 0 (x) = (x z)q 0 (x)+q(x) p 0 (z) = q(z) Thus to evaluate p(x)andp 0 (x) simultaneously at x = z, we can use nested multiplication for p(z) and we can use the intermediate steps of this to also evaluate p 0 (z). This is useful when doing rootfinding problems for polynomials by means of Newton s method.

APPROXIMATING SF(x) Define SF(x) = 1 Z x sin t dt, x 6= 0 x 0 t We use Taylor polynomials to approximate this function, to obtain a way to compute it with accuracy and simplicity. 1.0 y 0.5-8 -4 4 8 x

As an example, begin with the degree 3 Taylor approximation to sin t, expanded about t =0: sin t = t 1 6 t3 + 1 120 t5 cos c t with c t between 0 and t. Then 1 x Z x 0 Z x 0 sin t = 1 1 t 6 t2 + 1 120 t4 cos c t Z sin t x t dt = 1 1 0 6 t2 + 1 120 t4 cos c t dt = x 1 18 x3 + 1 Z x 120 0 t4 cos c t dt sin t t dt = 1 1 18 x2 + R 2 (x) R 2 (x) = 1 1 120x xz 0 t 4 cos c t dt How large is the error in the approximation SF(x) 1 1 18 x2

on the interval [ 1, 1]? Since cos c t 1, we have for x>0that 0 R 2 (x) 1 Z 1 x 120x 0 t4 dt = 1 600 x4 andthesameresultcanbeshownforx<0. Then for x 1, we have 0 R 2 (x) 1 600 Toobtainamoreaccurateapproximation,wecanproceed exactly as above, but simply use a higher degree approximation to sin t.

In the book we consider finding a Taylor polynomial approximation to SF(x) with its error satisfying R 8 (x) 5 10 9, x 1 A Matlab program, plot sint.m, implementing this approximation is given in the text and in the class account. The one in the class account includes the needed additional functions sint tay.m and poly even.m.

BeginwithaTaylorseriesforsint, sin t = t t3 3! + t5 5! +( 1)n 1 t 2n 1 (2n 1)! t2n+1 +( 1) n (2n +1)! cos(c t) with c t between 0 and t. Thenwrite Sint x = 1 x Z " x 0 1 t2 3! + t4 t 2n 2 +( 1) n 1 (2n 1)! =1 x2 3!3 + x4 5!5 x 2n 2 5! # dt + R 2n 2 (x) +( 1) n 1 (2n 1)!(2n 1) + R 2n 2(x) R 2n 2 (x) = 1 x Z x 0 ( 1)n t 2n (2n +1)! cos(c t) dt

Z x R 2n 2 (x) = 1 t 2n x 0 ( 1)n (2n +1)! cos(c t) dt To simplify matters, let x>0. Since cos(c t ) 1, Z x R 2n 2 (x) 1 t 2n x 0 (2n +1)! dt = x 2n (2n +1)!(2n +1) It is easy to see that this bound is also valid for x<0. As required, choose the degree so that From the error bound, R 2n 2 (x) 5 10 9 max x 1 R 2n 2(x) 1 (2n + 1)!(2n +1) Choose n so that this upper bound is itself bounded by 5 10 9.Thisistrueif2n +1 11, i.e. n 5.

The polynomial is p(x) =1 x2 3!3 + x4 5!5 x6 7!7 + x8 9!9, 1 x 1 and SF(x) p(x) 5 10 9, x 1 To evaluate it efficiently, we set u = x 2 and evaluate g(u) =1 u 18 + u2 600 u3 35280 + u4 3265920 After the evaluation of the coefficients (done once), the total number of arithmetic evaluations is 4 additions and 5 multiplications to evaluate p(x) foreach value of x.