Computer Programming (TKK-2144) 13/14 Semester 1 Instructor: Rama Oktavian Office Hr.: M.13-15, W. 13-15 Th. 13-15, F. 13-15.

Presentation on theme: "Computer Programming (TKK-2144) 13/14 Semester 1 Instructor: Rama Oktavian Office Hr.: M.13-15, W. 13-15 Th. 13-15, F. 13-15."— Presentation transcript:

Computer Programming (TKK-2144) 13/14 Semester 1 Instructor: Rama Oktavian Email: rama.oktavian@ub.ac.id Office Hr.: M.13-15, W. 13-15 Th. 13-15, F. 13-15

Outlines 1. Roots of equation 2. Graphical method 3. Interval and goal-seek method 4. Example in chem.eng

Roots of equation Problem in chemical engineering Sometimes is in POLYNOMIAL EXPRESSION an expression consisting of variables (or indeterminates) and coefficients, that involves only the operations of addition, subtraction, multiplication, and non-negative integer exponents

Roots of equation Example of polynomial Quadratic polynomial Polynomial degree-n Polynomial degree-3

Roots of equation Polynomial function f (x) = a n x n + a n-1 x n-1 +…+ a 2 x 2 + a 1 x + a 0 is called a polynomial function of x of degree n. The number a n, the coefficient of the variable to the highest power, is called the leading coefficient.

Roots of equation A value of x that makes y = 0 Setting the Factors of a Polynomial Expression equal to zero gives the Solutions to the Equation when the polynomial expression equals zero. Another name for the Solutions of a Polynomial is the Roots of a Polynomial !

Roots of equation Factors of polynomial when they are multiplied, they equal that polynomial:

Roots of equation Solving polynomial to find the roots of polynomial Factoring polynomial Rearrange the terms to have zero on one side: Factor: Set each factor equal to zero and solve:

Roots of equation Solving polynomial to find the roots of polynomial For this polynomial The Factors are:(x + 5) & (x - 3) The Roots/Solutions are:x = -5 and 3 The Zeros are at:(-5, 0) and (3, 0)

Roots of equation Finding roots and zeros of polynomial Graphical method The Zeros of the Polynomial are the values of x when the polynomial equals zero. In other words, the Zeros are the x-values where y equals zero.

Roots of equation Finding roots and zeros of polynomial Graphical method

Roots of equation Finding roots and zeros of polynomial Interval-halving method Algorithm: 1.Creating a table of x value and corresponding y value 2.Identify two different sign of y values (one is positive and another is negative – starting value of x value 3.Find the midpoint of x1 and x2 – x3  substituting to the function 4.Choose either x1 and x3 or x2 and x3 which has opposite sign as new pair x values and the interval between them is low 5.Repeat step 1 – 4 after the desired accuracy is reached

Roots of equation Finding roots and zeros of polynomial Interval-halving method

Roots of equation Finding roots and zeros of polynomial Interval-halving method 1.Cell A3 and C3 are starting point of x1 and x2, cell B3 and D3 are the formula of the function 2.Cell A4 calculates the midpoint of x1 and x2 with formula 3.Cell C4 selects the y value that has the opposite sign to the value in the previous row

Roots of equation Finding roots and zeros of polynomial Goal-seek method Built-in function in excel – to find x value that makes y value become zero Probably involves Newton-Raphson method Example The root of equation will be in this interval

Roots of equation Finding roots and zeros of polynomial Using Goal-seek in excel

Roots of equation Finding roots and zeros of polynomial Using Goal-seek in excel

Roots of equation Finding roots and zeros of polynomial Using Goal-seek in excel

Roots of equation Problem solving in chemical engineering

Download ppt "Computer Programming (TKK-2144) 13/14 Semester 1 Instructor: Rama Oktavian Office Hr.: M.13-15, W. 13-15 Th. 13-15, F. 13-15."

Similar presentations