0% found this document useful (1 vote)
3K views

Book

Uploaded by

nauman khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (1 vote)
3K views

Book

Uploaded by

nauman khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 568
Cerra Simplified Numerical Analysis I Using C++ and MATLAB Ore Hamayun Farooq WC MO Lae OO EO I Asocdk ALi Khoi 6835 University dL Education, Laheve. ; . Coalkan Camps) Simplified Numerical Analysis I Using C++ and MATLAB Dr. Amjad Ali (Principal Author) oe BaD Hamayun Farooq Muhammad Umar * (Co-Authors) yp AS Pure and Applied Mathematics (CASPAM) ed Bahauddin Zakariya University (BZU) Multan, Pakistan Centre for Advanced Studies in Simplified Numerical Analysis 1 Dr. Amjad Ali (Principal Autbor) ©2018, TimeRender Publishers. ISBN: 978-969-7821-01-3 (for Special Edition) ISBN: 978-969-7821-00-6 (for Economical Edition) All rights reserved. No part of this publication may be reproduced, or transmitted, in any form or by any means- inclu f i ; + inclu but not limited to, electronic, mechanical, photocopying, recording, or, otherwise or used for oy commercial purpose what so ever without the prior written permission of the publisher and the principal author. Typeset: Mostly personally by Dr. Amjad Ali (Principal Author), also contributed by the co-authors, iziralmasqat@ gmail.com) Illustrations Composing: Nazir Ahmad (nai com) Title Design: Muhammad Rizwan Qadeer (mrizwangadeer@em Teer Publishers Distribution Point: 238-B (PRIDE), Near Girls Comprehensiv Cell Phone: 0348-6981925 [email protected] e School, Gulgasht Colony, Multan, Pakistan. timerenderp! Scand ith Camsoanne preface «simplified Numerical Analysis 1” is an outcome of several years of relevant teaching and writing efforts. The main intension in writing this book is to make value-addition for our students through an easy approach. It has been authored with very specific objectives in mind, which are around the goal that our students should be uplifted and their learning of the subject should properly be aligned with the spirit of such a powerful and impactful subject of science and engineering, This text is designed to help the students to adopt such a style and approach of learning that can help them to achieve the true understanding. The relevant challenges have been addressed through a number of strategic portrayals. The question sentences have been inserted under the section/subsection headings (before the topical discussion) to emphasize what specific points or concerns a particular topic focuses. This approach might also be very useful in satisfying the concern of our students to be specific and definite about the exam questions and getting impression of being secure about exam performance. The topics of the book are relevant to the different courses with different objectives (being relevant for a variety of undergraduate programmers). Therefore, almost each of the chapters is made to comprise three parts: Discusses about the basic concepts MoTIF: Corridor! BASICS and methods of the chapter and is | needed by everyone Let’s plan it Discusses about some analysis and | further insight into the topics and is | | supposed to be focused by the mone: | Corridor I ANALYSIS | students of Numerical Analysis, | perhaps not by the students of Let’s think deep | Numerical Methods or Numerical Computing like courses | / PROGRAMMING | {ais about viewing the numerical MOTE: Corridor tl ercape. | methods as workable recipes and : programming them for the computers Let’s do it The readers can pin-point the topics/questions from the three portions/corridors accordiny to the course requirements or according to the personal need. Scand ith Camsoanne Juctance in getting benefits of the numerical frequently feel a serious rel ret ae tee hr progiaimalog these for the computers and hence face difficulty in sees ie eaesiparang needs of the subject. The Corridor II! purposefully focuses on essin eliminating the misconceptions, and bridging the gap of understanding through training. The patterns of the topical descriptions and working out of the numeric Problems in this text are designed to facilitate the instructor to focus most of the time on explaining the soit and concept of the topics rather than reproducing the material on the board or performing the numeric calculations during the lecture. It may also be noted that the description or working- out under any question or problem is made to be self-complete so that whatever assumption is needed to be made or whatever equation is needed to be referred is already present there as a part of the discussion. Further, the equation numbering under any question or problem has been made to start from “1” to give a feel to the students as their own self-study notes. 'highly acknowledge the guidance and encouragement of my teacher and PhD supervisor Dr. Khalid Saifullah Syed about the relevant topics. | am also thankful to Mr. Ahmad Hassan (BZU, Multan), Dr. Zaheer Abbas (IUB, Bahawalpur), Dr. Muhammad Ishaq (coMsaTs University, Vehari Campus), Dr. Fiza Zafar (BZU, Multan), and Ms. Saima Rana (B2U, Multan) for time to time discussions on the relevant topics. | congratulate and thank my students Aniga Faizan, Amna Waheed, Sanam Shehzadi and Muhammad Sajawal Naeem for supporting me in typing some part of the manuscript. | say thanks to the classes of BS Mathematics (Session: 2015-2019, Evening), MSc Mathematics (Session: 2017-2019, team lead: Syeda Amna Batool) at CASPAM, BZU for helping me out in detecting typing/numeric mistakes. | cannot forget to say thanks to my NA course teacher Prof. Dr. Azad Akhter Siddqui (during my MS, back in 2002) at NUST whose style made me to believe that Mathematics can be spoken fluently in the form of simple ideas, rather than just written symbolically. | am also thankful to all of my colleagues at CASPAM, BZU for their scholastic companionship. My gratitude is due for my lovely Father and my friend Engr. Afzal Ahmad Khan for persistent encouragement and pushing me forward. Engr Afzal Ahmad Khan not only played a role as a mentor, but also arranged assistance for the publication Process. Thanks to all my near-and-dear ones for their Prayers, support, encouragement and compromises due to my involvement in the write-up. | also acknowledge and appreciate the efforts of the following contributions by our National authors: * Saeed Akhter Bhatti, Naeem Akhtar Bhatti, “A First Course in Numerical Analysis with C+”, A-ONE Publishers, Lahore. Scand ith Camsoanne il « Faiz Anmad, Muhammad Afzal Rana, “Element: Foundation, Islamabad. s of Numerical Analysis”, National Book « Muhammad Iqbal, “An Introduction to Numerical Analysis”, limi Kitab khana, Lahore « Amjad Pervez, “An Introduction to Numerical Analysis”, A.H. Publishers, Urdu Bazar, Lahore. | have not only been benefitted by these contributions but these books also set benchmarks for me to start with. 1 would like to develop a liaison with the community of Numerical Analysis so that | can better understand the contemporary needs of the community and try to address those in my text. The errata and the softcopies of C++ or MATLAB programs can be asked through the email (although soon they will be uploaded on the webpage of the book). Finally, it’s my humble request to all the relevant readers to assist me through guidance and suggestions for improving this text so as to make it a national monumental contribution in the field. | pose the following pertinent question in this regard to the course instructors and request that a comprehensive reply may kindly be sent. Question: “What short-comings are there, which prohibit this book to be declared as the recommended book of Numerical Analysis/Methods | in the universities”? Dr. Amjad Ali (Principal Author) [email protected] 15-Apr-2018 Scand ith Camsoanne Table of Contents Chapter 1: Preliminary Concepts in Numerical Analysis 1.1 Introduction. 1.2 Number ‘Systems ar 1.3 Round-off Error 14 Truncation Error.. Chapter Summary Chapter Excercises Representations... Chapter 2: Solution of a Nonlinear Equation in One Variable 2.1 Introduction 2.2 Bracketing Method . 2.2.1 The Bisection Method (or Bolzano Method)... 2.2.2 | The False-Position Method (or Regula-Falsi Method). 2.3 Open Methods : 2.3.1 The Fixed-Point Iteration Method... 2.3.2 The Newton-Raphson Method 2.3.3. The Secant Method 2.4 Stopping Criteria and Convergence Rate .. Genes. Corridor I: ANALYSIS 2.5 Convergence Analysis The Bisection Method The Regula-Falsi Method The Secant Method .... The Newton-Raphson Method. The Fixed-Point Iteration Method. 2.6 Further Discussions... Bears Corridor Ill: PROGRAMMING ARCADE 2.7. Algorithms and Implementations .. The Newton-Raphson Method. The Fixed-Point Iteration Method.. The Secant Method The Bisection Metho« The Regula-Falsi Method Built-in MATLAB Commands Chapter Summary .. Chapter Excercises .. Scand ith Camsoanne Chapter 3: Polynomial Interpolation I 3.1 _ Introduction. 3.2. Newton's Divided erence Interpoation 3.3. Lagrange Interpolation 3.4 Error of Interpolation... 3.5 Deriving the Lagrange Interpolation Formula from the Newton's Divided- Difference Formula.211 3.6 _ Interpolation Formulas for Equally Spaced Nodes 24 E Corridor Ill: PROGRAMMING ARCADE 3.7 Algorithms and implementations.... Built-in MATLAB Commands... Chapter Summary .. Chapter Excercises .. Chapter 4: Numerical Integration I a Corridor: 4.1 Introduction 4.2. The Trapezoidal Rule . 43. The Simpson's 1/3 Rule 4.4 Generalized Closed Newton-Cotes Quadrature .. Corridor I: ANALYSIS 4.5 Truncation Error of the Trapezoidal Rule .... 4.6 Truncation Error of the Simpson's 1/3 Rule 4.7 Further Discussions .. I: BASICS Corridor Il; PROGRAMMING ARCADE. 4,8 Algorithms and implementations... . The Composite Trapezoidal Rule.. The Composite Simpson’s 1/3 Rule The Composite Simpson’s 3/8 Rule Built-in MATLAB Commands Chapter Summary ... Chapter Excercises .. Chapter 5: Numerical Differentiation I 5.1 _ Introductiot 5.2 Finite Difference Approximations of Derivatives using the Taylor Series.. 5.2.1 First Order Derivatives .. 5.2.2 Second Order Derivatives 5,3 _ Listing of the Derivative Formulas Scand ith Camsoanne Chapter 6: Direct Linear Solvers I 6.1 _ Introduction to Linear System: 6.2 Solution of Linear Systems 6.3 Pivoting Strategies 6.4 The Gauss-Jordan Method. 6.5 Solution of Linear Systems using the LU Factorization Method . 6.5.1 The Doolittle’s Method....... 65.2 The Crout’s Method... 6.5.3 The Cholesky’s Method acs 66 Operation Count Analysis 6.7 Matrix Inversion. ans 7 68 Algorithms and Implementations .. The Guassian Elimination Method with Partial ivoting Solving AX = B using the Do-little's Method Solving AX = B using the Crout's Method .. Solving AX = B using the Cholesky's Method Performing Operation Count Analysis Built-in MATLAB Commands Chapter Summary ... Chapter Excercises .. the Gaussian Elimination Chapter 7: Iterative Linear Solvers I Corridor I: BASICS 7.1 Basic Method! 7.1.1 The Jacobi Method 7.1.2 The Gauss-Seidel Method 7.1.3 The SOR Method... 7.2. Vector Norms and Distance: 7.3. Convergence Criteria .. Corridor I: ANALYSIS. 7.4 Matrix Norms and Conditioning 7.5 Iteration Matrix and Matrix Form of a Solver Corridor I: PROGRAMMING ARCADE 7.6 Algorithms and Implementations. Chapter Summary Chapter Excercises Scand ith Camsoanne Chapter 8: Eigenvalues and Eigenvectors I 8.1 Basic Definitions and Concepts. 8.2. General Approach of Finding 83 Power Method of Finding the Largest Eigenvalue. 8.4 Discussion on the Power Method 8.5 Algorithm and Implementation Chapter Summary Chapter Excercises Bibliography .. Scanned by Asad Ali Scand ith Camsoanne Chapter 1 Preliminary Concepts in Numerical Analysis 1.1 Introduction Question 01: What is the spirit of numerical analysis? The methods to solve the mathematical problems can be categorized in two board approaches. One category has the analytic or exact methods, which obtain the exact solution of the problem. The second category has the so-called numerical methods which produce numbers that approximately represent the solution of the problem. In simple words, the numerical methods obtain some approximate solution of the problems, usually in the numeric form. The category of the exact methods is very limited in regard to the real-world problems. Therefore, the numerical methods have to play major role in providing the some reasonable solution of the problems of practical interest in all branches of science and engineering. Numerical Analysis is the field of deriving/devising, analyzing and implementing the numerical methods. The most common approach followed by the numerical methods is the iterative approach. According to which, choose an initial approximation or guess to the solution and apply a set of simple computational steps to obtain a better approximation. Repeatedly apply the same set of steps to the better approximations, ultimately obtaining a sufficiently accurate solution and then stop the repetition. Each course of repetition of the set of computational steps is called iteration. The specialty of this approach is that the set of computational steps to be applied repeatedly can easily be programmed for execution on the computers. Therefore, even if a large number of iterations are required to refine the solution to achieve a sufficient level of accuracy, the computers are there to perform the labour work efficiently. As the solution obtained by a numerical method is an approximation to the exact solution, hence ithas some error. The error can be defined as the gap between the approximate solution and the exact solution. Scand ith Camsoanne Preliminary Concepts in Numerical Analysis 2 ean ‘Question’ 02: Whats the scientific computing? ef eee inputitig? And how the jndinleHeal analysis iSrelated to the problems in scence ud coghering according to this approzc; the cesl werldprotem is Ba , proach, the real world problem is first converted to a suitable mathematical form, which is then numerically solved on computer (possibly using high performance or parallel computing on a supercomputing/parallel machine), ‘The solution is then interpreted (usually through the use of graphing software) and implemented in the relevant field. Scientific computing enables to reduce the need of physical experiments, thus saving costs and expanding insights. Note that a scientific computing activity involves roles on (@ field of application, (éi) numerical mathematics, and (iii) computer. Thus, the rumertcal analysis may be regarded as the “mathematics of scientific computing”. ‘The scientific computing is playing role for research and development in every filed of science and engineering, The main factors for the ever increasing role of scientific computing include: * continuous development of advanced computing infrastructures (hardware and software), * steep decline in computing cost, and continuous development of efficient numerical algorithms. Question 03: What are the approaches for quantification ofthe error in approximations? Let xq represent an approximation to a certain quantity whose true (or exact) value is x,. The gap between these two quantities is the error. error is the absolute error. It is absolute value of the The very first approach to quantify the ximate values. If E, denotes the absolute error then, difference between the true and the appro» [True value ~ Approximate value| Absolute Error or E, = (|x7*al lative error. It is ratio of absolute error to the ach to quantify the error is the re ‘Another appro If E, denotes the relative error then, magnitude of the true value. apsolute error _ [True value — Approximate value| ; _ absolute error _ Relative Error = “True valuel True valuel or Scand ith Camsoanne 3 : Simplified Numerical Analysis 1 bee = Ey Ixel The relative error shows how much is the absolute error in the approximation, relative to the true value, It can also be represented as how much percent the absolute error is there relative to the true value. That is, Percentage Relative ror = 2bSoluteerror ag [True value] or xt — x g = Ml x 100% xel . Remarks: 1) The absolute error measures the error in terms of the same unit as the unit of quantities. For example, if the units of the exact and approximate values are meters, centimeter, or kilogram, etc, the unit of the absolute error will be meter, centimeter, or kilogram, etc. The relative error is defined in the form of ratio and is independent of the units of measurement. It is useful in making comparison of the error of two different quantities. 2) The relative error is undefined in case when the exact value is zero; that is, the term E is undefined when x; = 3) In case, when the exact value is unknown and the some iterative approach is use to generates a sequence {x}, of approximations to the exact value, the error is often estimated as the difference between the previous and current approximations. The current approximation is considered as the true value and the previous approximation is considered as the approximate value. Thus, the absolute and relative errors at (k + 1)th iteration is defined as follows: Absolute Error [current Approximation — Previous Approximate] ie B= [atte x Rel |Current Approximation ~ Previous Approximate| lative Error = [Current Approximation] ie, xt) — x®| B= ce Scand ith Camsoanne Preliminary Concepts in Numerical Analysis 4) The relative error might sometime be more meaningful than the absolute error in quantifying the error. For example, consider a true value of 100 is approximated by 90 and therefore the absolute error is 10. Consider, another true value of 1000 is approximated by 999 ang therefor the absolute error is 10. It appears that the absolute errors in both the situations are i jg 100790 the same. However, note that the relative error is [> -1 = 10% in the first case ang 1000-990 Joo = 0-01 = 1% in the second case. Thus, it is the relative error which elaborated that the error in the first case is much severe as compared to the error in the second case, Problem 0: ‘uppose that you have the task of measuring the lengths of a bridge and a'rivebad come up with 9999 cm and 9 cm, respectively. If the true values are 10,000 cm and 10 em, respectively, then compute absolute error, relative error, and percent relative error, Solution: Absolue error in length ofabridge = |10,000cm-9999em| = 1cm Absolute error in length ofarivet = |10cm—9cm| = tem _. _ [10,000 em ~ 9999 cm| Relative error inlength of bridge = TET = o.oo 1 ink ian [tem —9em) 4 Relative error inlength of arivet = TTS . [10,000 cm ~ 9999 cm| i Soaaeem = 001% Percent error in length of a bridge To god emt % 100% [10 cm —9 em] Percent error in length ofarivet = POC 9CM ioo4, = 100% Ti0 emi . Question 04: What are sources/types of errors in approximations? 3 ‘The errors can be categorized in three major categories in regard to their sources: 4. Inherent Error (quite unrelated to the numerical methods) «* Human mistakes/blunders in measurements © Modeling errors due to simplification assumptions © Data uncertainty Scand ith Camsoanne Simplified Numerical Analysis 1 2. Round-off Error (undesired but have to be made) * Occurs due to approximation of numbers as a computer cannot represent certain numbers exactly due to its limitation of ability with respect to size and precision. * Occurs due to approximation of numbers to limit the level of precision (Le, not using the decimal digits after a certain place) * Occurs in certain mathematical manipulations that are highly sensitive to the round-off error. 3. Truncation Error (truly mathematical error, made intentionally to avoid insignificance) * Occurs due to approximation of an exact mathematical procedure, e.g. ignoring terms from the Taylor/infinite series expansions of trigonometric or exponential functions. . Remark: The truncation error is truly the mathematical error. However, it is common to formally study or analyze the round-off error and truncation error for the numerical methods. Remark: The round-off error performed for one instance of approximating a number is regarded as local round-off error. However, for all the numerical computations of a method/algorithm, the approximations of numbers are performed a very large number of times. The numerical scientists are often interesting in the collective effect of all the instances of number approximations. That is referred to as global rounding-off error. Similar description of local and global error might be made for the truncation error. Question 05: What are the scientific and normalized scientific notations of representing real number? %: A real number (in decimal form) has an integer part, a fractional part, and a decimal point between the integer and fractional parts. A scientific notation is a representation of a real number in a standard way. It can be obtained by shifting the decimal point to left or right such that it has only one non-zero digit to the left of decimal point and the figure is multiplied by 10 with an appropriate integer value of the exponent. For example, each of the real numbers 0.0001057, 65.46473, and 3,100,000 has an alternative representation in scientific notation as 0.000157 = 1.057 x 10-* 65.46473 = 6.546473 x 10 3,100,000 = 3.1 10° ‘Scand ith CamSoanne Preliminary Concepts in Numerical Analysis Another standard form called normalized scientific notation, which is more relevant in the context of computer representation, is obtained by shifting the decimal point in such a way that the integer part is zero, the leading digit in the fractional part is nonzero, and the exponent of 19 is set accordingly. Thus, each of the preceding example numbers has an alternative representation in normalized scientific notation as 0.000157 = 0.1057 x 10° 65.46473 0.6546473 x 107 3,100,000 = 0.31x 107 Question 06: What are the significant figures (or significant digits) of an approximate number? Significant figures of a real number (which is an approximation of a true value) are the digits that are used to express the number meaningfully. The significant digits begin with the leftmost nonzero digit and ends with the rightmost correct digit. The right most zeros which are exact are also significant. Note that all the non-zero digits (1,2,3,--.9) are considered significant. Zeroes appearing anywhere between two non-zero digits are significant eg,, in 3005.00102 there are 9 significant digits. Leading zeros (left to the first non-zero digit) are not significant, e.g,, the number 0.000081 has two significant digits only, namely 8 and 1. The leading zeros are used just to fix the decimal place. Trailing zeroes are significant if they are exact with regard to some true value. The significant figures of a number can easily be pursued by using its normalized floating-point form. The digits in the mantissa are regarded as significant figures. For example, the number 42.134, 6.0013, and 0.0015784 all have five significant figures, It can be obtained by converting these numbers in normalized floating-point form as: 42.134 = 0.42134 x 10? 6.0013 = 0.60013 x 10 0.0015784 = 0.15784 x 10-3 ) . Remark: An approximation x* to a number x is called accurate to ¢ significant figures if there are exactly t digits in the mantissa of x° that agreed with the first ¢ digits of the mantissa of x having the same exponent or characteristics. That is, if the number x is represented in the following form x = £0.dydgdy-dydeyy 10 ‘Then, the number x* is accurate to ¢ significant figures to the numb: following form x = £0.didedy ~~ dedigs +X 10° er x if it can be written in the Scand ith Camsoanne Simplified Numerical Analysis 1 ‘Question 07: Explain the difference between precision and accuracy. eRe Accuracy of an approximate value is a measure how much the approximate value agrees with the true value, If an approximate value is accurate to n decimal places then this means that n digits to the right of the decimal point are trustworthy. If an approximate value is accurate to n significant digits then this means that a total of n significant digits are trustworthy (definitely, the digits beginning with the leftmost non-zero digit). Precision on the other hand has nothing to do with how much the approximate value agrees with the true value. Precision is only concerned about the size of the number. A value of 7.81235 is more precise than the value 7.812. on 1.2 Number Systems and Representations Question 08: What are the commonly used number systems? ‘A number system offers a specific set of symbols to represent numbers or quantities. The number of symbols offered by a number system is called the base of the system. These symbols are sometimes referred to as digits. Usually the digits of a number system with base (say) f are 0,1,2,-,8 — 1. For example, the decimal system has the base 10 with ten digits 0,1,2,-,9 to represent the numbers. Ina positional number system with the base B, a number x can be represented as: Cp = andy do.d-1d-2 (p= bn XP" + dna X fh + om + dy x B° + dyxPt + dgxB? +o ~ + dinxpm™ where the symbol ff indicate the base in which the number x is written and each d; is a digit of the number system. ‘The following four are the commonly used number systems, even supported by the computer architectures. 1) Decimal number system 2) Binary number system 3) Octal number system 4) Hexadecimal number system Scand ith Camsoanne Preliminary Concepts in Numerical Analysis 8 system is the most widely decimal system is repres: is the base-10 number system. In everyday life the decimal number 'y used system to represent the numbers or quantities. Any number in ented by the combination of some of the ten digits 0,1,2,3,4, 5,6,7,8,9 with appropriate power of 10 specifying the manganite. For instance, the successive Positions to the left of the decimal point represent units, tens, hundreds, thousands and so on. The decimal Integer number 6546 in positional notation is a polynomial in the base 10, given as follows: (6546)i9 = 6x10? +5x 10? +4x10' +6 x 10° Similarly, a fractional decimal number 0.4731 in positional notation is a polynomial in 10-* as follows: (0.4731), = 4x107°+7x10-% 43x 10-41% 107 Thus, the decimal number 6546.4731 has the following positional notation representation as a sum of the above two notations: (6546.4731), = 6x10°+5x10?+4x10'+6x 10° +4x 107° +7x 1077 +3x 10% +1x 10% In general, the decimal number x = dydy-1**do.d_,d_, "dm has the following positional notation representation in base-10 number system: Cro = dy X10" + dyy x10"? + = + dx 10° + dX? + dX? +o + dig X10 i umbs is the base-2 number system. The numbers at the lowest level in ina bi -2 number system. Any number in a binary system is are represented in a binary or base-2 num! n represented b the combination of two symbols: 0 and 1, called bits with appropriate power of 2 specifying the magnitude ‘A binary number 1011 in positional notation is a polynomial in the specit base-2 number system given as follows: (1011). = 1x 2340x227 41x2°41x2° 8 +0 +2 +1 Do + 1011 is equivalent to the decimal number 11, Similarly, tional notation is a polynomial in 2~* given as follows: a fractional i mbe Thus, the binary mu D binary number 0.1101 in posi - 4 ax 2b+1x27+0x2 341% 2 1 1.1 tater (0.1101)2 = " 13 _ (0.8125),0 16 W Scand ith Camsoanne 9 Simplified Numerical Analysis Thus, the fractional binary number 0.1101 is equivalent to the decimal number 0.8125. As a consequence, the binary number (11011.1101), is equivalent to the decimal number (21.8125),0. /-m has the following positional In general, the binary number x = dydy-1 Lid notation representation in base-2 number system: G2 = dyX 2" + dyyX2™2 $m # dy X29 + dyx2? + dgx2? + - + dimx2™ and Hexadecimal r are base-8 and base-16 number systems, respectively. A number in an octal system is represented by the combination of eight symbols: 0, 1, 2, 3, 4, 5,6, 7. Anumber ina hexadecimal is presented by the combination of sixteen symbols: 0, 1, 2, 3,4, 5,67, 8,9,4, B,C, D, E, F. An octal number 151.714 in positional notation is given as follows: (151.714) 1X82 45x41 894 7XS +1 XSF 44x BE 64 + 40+1 + 0.875 + 0.015625 + 0.0078125 (105.8984375)10 ‘Thus, the octal number (151.714). is equivalent to the decimal number (105.8984375),0- umber from any number system can be converted to another number system. It is jon but its conversion to another system Remark: possible that a number in one system has a finite express has an infinite expression. Question 09! What are the fixed-point and floating-point representations of a real number? in general, has finite or infinite sequence of digits in the fractional part. In table only with a finite number of digits after the decimal umbers, called fixed-point and floating-point Every real number, practice, the numbers are represent point. There are two ways of representing real n representations. presentation, the numbers are given with a fixed number of digits after the decimal point. For example, 64.4647, 0.0143, and 2.0000 are some the numbers inthe fixed-point form with 4 digits after decimal point, Fixed-point representation is almost impractical due to its very limited range of possible representations within the given number of places to store the digits of the numbers. In the fixed-point re tions offer a much larger set of numbers that can be stored within the Floating-point representa In the floating-point representation, the numbers are given in the given number of places. Scand ith Camsoanne Preliminary Concepts in Numerical Analysis 19 normalized scientific notation. For instance, any nonzero real decimal number x in floating-point form can be represented as x = £0.d,dyd3-- x 10° Here dj,i = 1,2,-- are digits from 0 to 9 with d, + 0, called most significant digit and e is an integer that might be positive, negative or zero, called an exponent or characteristic. The number 0.d;d,d3--, may be denoted by m, is called the finite normalized mantissa. For numbers in decimal system with base 10,4

You might also like