Você está na página 1de 4

Faculty of Engineering and Technology Chemical Engineering Department 0905301 Numerical Methods in Chemical Engineering

Chapter 1 Numerical Computing and Computers


Analytical analysis:
Usually gives a result in terms of mathematical functions that can then be evaluated for specific instances.

Numerical analysis:
1. Solution is always numerical. 2. Can compute functions by standard methods [addition, subtraction, multiplication and division]. 3. Has a major advantage which is than a numerical answer can be obtained even when a problem has no analysis solution. 4. The result from numerical analysis in an approximation. 5. Numerical analysis can do the following operations:o Solve for the roots of a nonlinear equation. o Solve large systems of linear equations. o Get the solutions of a set of nonlinear equations. o Interpolate to find intermediate values within a table of data. o Find derivatives of any order for functions. o Integrate any function even when known only as a table of values for the variables. o Solve boundary value problems and determine eigenvalues and eigenvectors. o Obtain numerical solutions to all types of partial differential equations. o Fit curves to data by a variety of methods.

Communication with Computers


Human beings do arithmetic using the decimal (base 10) number. Computers do arithmetic using the binary (base 2) number. 1. Communication with the computer (input/output) is in base 10. 2. In fact, computers convert inputs to base 2 then perform base 2 arithmetic. 3. Finally computers translate the answer into base 10 before it displays the result. 4. Due to the conversion from decimal to binary some approximation happens.

Decimal Numbers
Let N denote a positive integer, then the digits a0, a1, ., ak exist so that N has the base 10 expansion: N = a k 10 k + a k 110 k 1 + ........................ + a1101 + a 0 10 0 where the digits ak are chosen from {0, 1, , 8, 9}. N is expressed in decimal notation as: N = a k a k 1 ........................a1 a 0ten

Binary Numbers
Let N denote a positive integer, then the digits b0, b1, ., bj exist so that N has the base 2 expansion: N = b j 2 j + b j 1 2 j 1 + ........................ + b1 21 + b0 2 0 where each digit bj is either 0 or 1. Thus N is expressed in binary notation as: N = b j b j 1 ........................b1b0two

Conversion from Decimal Integer to Binary

An efficient algorithm for finding the base 2 representation of the integer N can be written as: N = 2Q0 + b0
Q0 = 2Q1 + b1 ....... ....... ....... Q j 2 = 2Q j 1 + b j 1 Q j 1 = 2Q j + b j

Qj = 0 Values of bo, b1, , bj have the value of either 0 or 1. The representation of the binary number then will be: N = b j b j 1 ........................b1b0two A decimal integer can always be exactly represented by a binary integer.

Conversion from Decimal Fraction to Binary


Binary fractions can be expressed as sums involving negative powers of 2. If R is a real number that lies in the range 0<R<1, there exist digits d1, d2, .., dn so that: R = d1 2 1 + d 2 2 2 + .......................... + d n 2 n

where dj {0, 1}

R = 0.d1 d 2 ................d ntwo

To generate a binary number for a fraction: - Multiply R by 2 2R - Find d1 = integer (2R) F1= fraction (2R) -

For other values of d d2, ., dn = integer (2Fn-1) For other values of F F2, F3, ., Fn = fraction (2Fn-1) The binary number = 0.d1d2d3dn The binary decimal representation of R is then given by the convergent geometric series R = d j 2 j
j =1

A decimal fraction can not always be exactly represented by a binary integer

Floating-Point Binary
Computers use a normalized floating-point binary representation for real number. This means that the mathematical quantity x is not actually stored in the computer. Instead, the computer stores a binary approximation to x in the form of: x mq 2n Where: q is the mantissa finite binary expression n is called the exponent (power) The number of binary digits is restricted in both the numbers q and n.

- In general, the binary numbers used in a digital computer are limited to a maximum length by the design of the machine. - This length varies from computer to another.

Single and Double Precision


Consider a 32-bit word length computer. The first bit is used for the sign of the number. Bits 2 through 8 hold 7 bits binary number indicating a power of 2 by which the fraction must multiplied to give the original number. Bits 9 through 32 are used to actually store the number, which is stored not in its full form, but as a fraction smaller than 1. Single precision uses only one computer word length. Double-precision arithmetic is an effort to increase the accuracy of floating-point calculations by adding more bits to the mantissa. Using the same 32-bits computer, we can now use two computer words instead of one, and add 32 bites more to the mantissa.

Causes of Serious Errors


12345Round off in adding or subtracting one large and one small number. Round off in subtracting two almost equal numbers Overflow and underflow. Division by a very small number. Round off in simple multiplication or division.

Type of Errors
True Error: Et = true value approximation

True percent relative error:

t =
Approximate error:

true value approximation *100% true value

E a = present approximation previous approximatin Approximate percent relative error:

t =

present approximation previous approximation *100% present approximation

Prespecified percent tolerance:

s = (0.5 *10 2n )%
where n is the number of significant figures

Você também pode gostar