Attribution Non-Commercial (BY-NC)

18 views

CSC307-Lab-02_0

Attribution Non-Commercial (BY-NC)

- Prog 24 First-Order Differential Equations
- Theory of Equations Volume I by Burnside & Panton
- Integrated Algebra - Chapter 5
- Design Oriented Analysis
- GENIUS MAKER - What is New in Genius Maker Software
- Item Analysis 2015
- Exam Kit for Social Science CBSE Class 10
- SHE1114 Outline
- algebra i syllabus
- Algebra (Syllabus)
- DLL MATH 8
- Factoring Polynomials With Algebra Tiles Lesson Plan
- CM Monthly Test Schedule & Syllabus
- Polynomial Function
- Lesson 3.4 Zeros of Polynomials.pdf
- 97087974 Arithmenonononrties
- Syllabus Breakup for Class VIII
- Damphousse
- ch2-polynomial and rational functions revised
- Crypto 15

You are on page 1of 8

A . . Harmattan Semester, 2011-2012 Session PRACTICAL LAB II CSC 307: Numerical Computations I

Contents

1 Laboratory Assignment II 1.1 Task 01: Canonical Polynomials . . . . . . . 1.2 Task 02: Horners Polynomials . . . . . . . . 1.3 Task 03: Root of Polynomials . . . . . . . . 1.4 Task 04: Evaluating Function as Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 4 5 6 6 7

Laboratory Assignment II

During our lectures, we have seen that polynomials provide an efcient means of representing some mathematical expressions. We have also seen that most trigonometric, hyperbolic, and exponential functions can be expressed in the form of polynomial. The accurate, efcient and effective evaluation of polynomials are therefore important in the development of computational solution to scientic and engineering problems. A polynomial of degree n is written as: Pn (x) = a0 x0 + a1 x1 + a2 x2 +, . . . , +a(n1) x(n1) + an xn Equation 1 can also be written in the form:

n

(1)

Pn (x) =

i=0

ai xi

(2)

Equation 1 and 2 are called the Canonical, Nave, Series or Sequential form of polynomial expression. The values ai , i = 0, 1, 2, . . . , n are the parameters of the polynomial and x is the variable (independent). A polynomial of degree one, i.e. n = 1, is called linear (it describes a line function or relation). Polynomials with degree two or more, i.e. when (n 2), are called non-linear functions. Specic names for polynomial commonly used in engineering applications are listed in Table 1. Table 1: Polynomial Nomenclature Degree 1 2 3 4. Name Linear Quadratic Cubic Quatic Representation a0 + a1 x a0 + a1 x + a2 x2 a0 + a1 x + a2 x2 + a3 x3 a0 + a1 x + a2 x2 + a3 x3 + a4 x4

Polynomials are frequently used in engineering problem description, modelling and simulation. This is because they exhibit a number of unique properties which include the following [2, 1, 3]: 1. Polynomials are smooth. 2. Polynomials are easy to store and manipulate on a digital computer. To store polynomials, we only need to store the coefcients (i.e. the ai s) and one variable (i.e. x). To manipulate polynomials we require only basic arithmetic operations of addition (+), subtraction (-) and multiplication (*). 3. The derivative and integral of a polynomial will produce another polynomial whose coefcient can be computed algebraically. 4. The root of a polynomial can be easily computed using an algorithm. 5. Given a continuous function or a set of values over a closed interval, say [a, b], it is possible to nd a polynomial to model or represent it. 6. Most engineering problems can be expressed as a polynomial of suitable degree n.

1. Using the four types of polynomial in Table 1, show that n(n + 1)/2 multiplications and n additions are needed to compute Equation 1, where n is the degree of the polynomial. 2. Study the pseudo-code in Table 2 and discuss the Design of a solution algorithm for Equation 1 using a owchart.

Linear y = a0 + a1x x

3. Write the programme to implement the algorithm you designed for Equation 1 using Plato Fortran and Octave.

Table 2: Algorithm for Canonical Polynomial Evaluation ____________________________________________________ START: " i => Index of the coefficient array " n => Degree of the polynomial " A[n] => Array element n " P => The result of the polynomial computations INTEGER i,n REAL A[n], X, P READ n READ A[i], i <- 0, n P = A[0] For i <- 1, n P <- P + A[i] * Xn NEXT i WRITE P END: ____________________________________________________

Another form of expressing Equation 1 is presented in Equation 3. Pn (x) = a0 + x(a1 + x(a2 + . . . , +x(an1 + x(an )))) Equation 3 is called the Horners or nested form of polynomial expression. 1. Using the four types of polynomial in Table 1, show that n multiplications and n additions are required to compute Equation 3, where n is the degree of the polynomial.. 2. Study the pseudo-code in Table 3 and discuss the Design of a solution algorithm for Equation 3 using a owchart. 3. Write the programme to implement the algorithm you designed for Equation 3 using Plato Fortran and Octave. (3)

Table 3: Algorithm for Horners Polynomial Evaluation ____________________________________________________ START: " i => Index of the coefficient array " n => Degree of the polynomial " A[n] => Array element n " P => The result of the polynomial computations INTEGER i,n READ n REAL A[n], X, P READ A[i], 0 <- 1,n P = A[n] For i <- 1, n P <- P*X + A[n-i] NEXT i WRITE P END: ____________________________________________________

1.3

Remember also that Equation 1 can be expressed as Equation 4. Pn (x) = (x x0 )(x x1 )(x x2 ), . . . , (x xn1 )(x xn ) or, in the short form

n

(4)

Pn (x) =

i=0

(x xi )

(5)

In Equation 4 and 5, x0 , x1 , . . . , xn are the roots of the polynomial. A root is a value which when you substitute into an equation, the result will be zero. This value corresponds to the point of stability or equilibrium of the system represented by the polynomial. Equation 5 requires n multiplications and n subtractions. Note that the computational load of the subtraction operation is more than that of addition, usually by a factor of 1.5. 1. Design the solution algorithm for Equation 4 using owchart and pseudo-code. 2. Write the programme to implement the algorithm you designed in 1. using Plato Fortran and Octave. Nota that, the programme you developed in Task 3 could be used to explore the root of the system modelled by Equation 1.

As stated earlier, the models for most scientic and engineering problems can be expressed in the form of a polynomial. In fact programming languages implement Builtin subprogrames which are used to compute most functions encountered in scientic and engineering problem solving. Such functions are implemented using algorithms based on Taylor series, which are polynomials. 1. Study the functions in Table 4 (on page 7) and conrm their correctness. 2. Design an algorithm to implement each of the functions. Your algorithm should facilitates a computation that takes variable number of terms (i.e. different values of n) in the series. 3. Implement the solution algorithm you designed in 2. using Octave. 4. Study your programme by computing the values of x in the interval [0.0, ] with 2 step 0.15 for 3, 5, 10 and 15 terms of each equation. 5. Using the Octave built-in functions, repeat the experiment in 4. [Note that you do not know the number of terms used in the Octave built-in functions]. 6. Plot your results in 4. and 5. and discuss your observations. Note that the rst neglected term in each series is taken to be the error in the computation. Polynomials will work well on sufciently small intervals. When larger intervals are used, however, severe oscillation often appears, particularly when the degree of the polynomial is more that 4. For practical engineering problems therefore, polynomials of degree 4 or less is recommended. If the interval is long, it can be divided up into smaller intervals and separate polynomials used to represent each of the smaller pieces of intervals: (This approach is the basis of the Spline interpolation method).

Engineering Application

As stated in the previous sections, most scientic and engineering models can be represented using polynomials. Some general problems have been studied and the numerical methods for their theoretical solution using polynomials have been developed. Examples of such polynomials include [4]: Chebychev polynomials, Laguerre polynomials and Hermite polynomials. For example, the second-order differential equation is useful in modelling the behaviour of a number of dynamic systems commonly encountered in engineering. The Laguerre form of such equation is given by d2 y dy + (1 x) + ny = 0.0 (6) dx2 dx In Equation 6, y is the dependent variable and x is the independent variable and n is a positive integer. The solution to this problem is a set of polynomial, which are x

orthogonal. Six of the Laguerre polynomials, which solves the model in Equation 6, are as listed in Equations 7 through 12: L0 (x) = 1.0 L1 (x) = 1.0 x L2 (x) = L3 (x) = L4 (x) = 1 2 (x 4.0x + 2.0) 2! (7) (8) (9) (10) (11)

L5 (x) =

(12)

1. Design the algorithm for computing the six Laguerre polynomial Equations. 2. Write a program to implement the algorithm in 1. and plot their values between x = 0.0 to x = 6.0 with step 0.5 using the Octave programming environment. 3. Discuss the accuracy of your results.

References

[1] J. G. Bronson. Algorithm Development and program design using C, volume 1. West Publishing Company, 1996. [2] U. Manber. Introduction to Algorithms: A creative approach, volume 1. AddisionWesley, 1989. [3] K. H. Rosen. Discrete Mathematics and Its Application, volume 5th . McGraw-Hill Higher Education, United States, 2003. [4] F. Scheid. Schaums Outline of Theory and Problems of Numerical Analysis. McGraw-Hill Publishing, New Delhi, 2nd edition, 2006.

Function ex

Table 4: Polynomial Representation of Some Functions Polynomial expression (n terms) x3 x4 x5 x2 1.0 + x + + + + ... = 2! 3! 4! 5!

n i=0

xi i!

cos x

1.0

(1)i

i=0

x2i 2i!

sin x

(1)i

i=0

sinh x

x+

n i=1

cosh x

1.0 +

n i=1

x(2i) (2i)!

1.0 (1.0 x)

1.0 + x + x2 + x3 + x4 + x5 , . . . =

i=0

xi

- Prog 24 First-Order Differential EquationsUploaded byDhany SSat
- Theory of Equations Volume I by Burnside & PantonUploaded byADITI Library
- Integrated Algebra - Chapter 5Uploaded bymathsmith
- Design Oriented AnalysisUploaded byBhavani Banala
- GENIUS MAKER - What is New in Genius Maker SoftwareUploaded byGoldenKstar
- Item Analysis 2015Uploaded byMarites c. de Asis
- Exam Kit for Social Science CBSE Class 10Uploaded byJohn Kelin
- SHE1114 OutlineUploaded byNursihah Amir
- algebra i syllabusUploaded byapi-469052173
- Algebra (Syllabus)Uploaded byjuncatalan
- DLL MATH 8Uploaded byRamil Demabogte
- Factoring Polynomials With Algebra Tiles Lesson PlanUploaded byJan Aquarian
- CM Monthly Test Schedule & SyllabusUploaded byprachir1501
- Polynomial FunctionUploaded byfaithreign
- Lesson 3.4 Zeros of Polynomials.pdfUploaded bymomathtchr
- 97087974 ArithmenonononrtiesUploaded byPolyjuice
- Syllabus Breakup for Class VIIIUploaded byNoman Qadeer
- DamphousseUploaded byGeorge Louis
- ch2-polynomial and rational functions revisedUploaded byapi-395386039
- Crypto 15Uploaded byNgoc Quy Tran
- Derivation of Tapered Beam p VerUploaded byRyan_Rajmoolie
- Lecture 18Uploaded byAnil Yvs
- chap6-2.pdfUploaded byAbu Anzar
- Lecture 2 - Richiami MatematiciUploaded byManuelLenti
- fem20Uploaded bychrissbans
- Takagi / Naito's Algorithm RevisitedUploaded byΟλυμπίδης Ιωάννης
- Working With Origin 7aUploaded bySupol
- UntitledUploaded byapi-162641823
- Meet2_2000-2009Uploaded byjayanta sarkar
- partial differential equationUploaded bySrujanSapkal

- Louise Pile - Emailing - 2004Uploaded byOxana Bogovaya
- NetBackup Troubleshooting GuideUploaded byLotus Perfaction
- TCPIPUploaded byKrishnakumar Voleti
- Chap 1_steam Power PlantUploaded byMuhammad Qusyairi
- Mitsubishi Pajero- The Dream CarUploaded byMotGives
- Gnu Sdr EttusUploaded byVĩ Cầm Nhỏ
- Intramodal Dispersion is Pulse Spreading That Occurs Within a Single ModeUploaded byGehendraSubedi
- MEMS with Microactuators -By SayyanUploaded bysayyan
- µPA1436AUploaded byGrigore Valentin
- Talpac EleleUploaded bycabro_chico
- Question Papers of Two Year m. Tech i Semester Regular Examinations April - 2013Uploaded byanjugadu
- Chap 6 EC TechnologyUploaded byNorji Ijung
- Vibrational Analysis of Cracked HooksUploaded byemilio9245
- Particles TutorialUploaded byPawel Piecuch
- A46 Guillier Et Al - BEE 2007Uploaded bySalvador Ramos Gomez
- Ieee 2014-2015 Matlab Projects Titles List Globalsoft TechnologiesUploaded byIEEEDOTNETPROJECTS
- ClutchUploaded bySahani Pandey
- IJMST_2016_66_Original_V0Uploaded byTusharGupta
- Ideas in ActionUploaded byJR Salatiel
- Pump Vibration AnalysisUploaded byRABIU M RABIU
- How to Change BIOS Language From Chinese to English USUploaded byG. Chandra Sekhar Reddy
- Course 20339-1A - Planning and Administering SharePoint 2016Uploaded byAshish Kolambkar
- ISUZU FVR900 specsUploaded byamgamundani
- ACMA Auto Industry-StatisticsUploaded byAmit
- EMD-1Uploaded byRafay Siddiqui
- Topic ArraysUploaded byMarilyn Low
- ne-1022f_smUploaded byRICHIHOTS2
- JTDX User Manual en 2018-01-08Uploaded byMariano
- Return Path Impairments in HFC networksUploaded byMauro Antivero
- 5 - API 570 Exam 100 QsUploaded bySunny Thundil