1.1 The Order of Precedence.

In a numerical operation, the order of precedence are BODMAS or BIDMAS.

B = Bracket Highest precedence

O = Of or I = Index

D = Divide

M = Multiplication

A = Addition

S = Subtraction Lowest precedence

Example 1

2– 3 + 4 = -1 + 4 = 3.

In this case, the subtraction and addition have the same precedence; thus we compute from the left- hand side to the right-hand side which is 2-3 = -1 and then add with 4 equals 3.

Example 2

2– ( 3 + 4 ) = 2 – 7 = -5

In this case, the bracket has a higher precedence and this operation in the bracket is done first. Thus, 3 + 4 = 7. Then 2 minus 7 equals -5.

Example 3

2+ 42 - 5 = 3 + 16 – 5 = 19 – 5 = 14

In this case, the index or power function is done first followed by addition and subtraction.

1. Directed Numbers

A number with a sign is either positive or negative.

+3 means move three steps to the right and -3 means three steps to the left.

The operations of directed numbers :

i) (-1) + (-4) = -5

ii) (-24) / (+2) = +12

iii) (-2)(+3) = (-6)

iv) (+8) – (-1) = (+9)

2.The commutative, associative and the distributive laws.

a) Commutative Law

Two functions are said to be commutative if the position of the numbers makes no difference to the answer.

Example 1 :

2+ 3 = 3 + 2 , the answer is 5 . We say addition is commutative.

Example 2 :

2– 3 ≠ 3 – 2, the answer on the left-hand side is -1 and the right-hand side is 1. We say subtraction is not commutative.

b) Associative Law

Two functions are said to be associative if the position of the brackets makes no difference to the answer.

Example 3 :

( 1 + 2 ) + 3 = 1 + ( 2 + 3 ), the answer is 6. We say addition is associative.

c) Distributive Law

Two functions are said to be distributive if they have the same answer after an operation of expansion from the bracket is made.

Example 4 :

a ( b + c) = ab + ac .Let say 3( 4 + 5) = 3(4) + 3(5) , the answer is 27 for both sides. So, we say multiplication is distributive over addition.

Basic Mathematics For Computing

A fraction has a numerator and a denominator.

Fraction = Numerator

Denominator

Types of Fractions :

a) Proper Fraction

The denominator is bigger than the numerator and is also called “bottom heavy”.

For example: 2/3 , 3 /4 etc.

b) Improper Fractions

The denominator is smaller than the numerator and is also called “ top heavy”.

For example : 3/2, 4/3 etc.

c) Equivalent Fraction

The fractions can be simplified or expanded further. For example : 8/16 = 4/8 = 2/4 = ½

d) Mixed Fractions or numbers

It consists of an integer and a proper fraction. For example : 2 3/4, etc

Operations on Fractions

i) Addition

½ + ¼ = 2 + 1 = 3

4 4

ii) Subtraction

2/4 – ¼ = 2-1 = 1

4 4

iii) Multiplication

½ * ¾ = 3/8

iv) Division

¾ divided by ½ = ¾ *2 = 6/4

a) Introduction to Decimals

A fraction can be represented into a decimal point.

1/10 = 0.1

1/100 = 0.01

1/1000 = 0.001

b) Place Values

The location of a number in a system defines the place value.

246.35

The number 2 above takes the place value of a hundred (100).

The number 4 above takes the place value of a ten (10).

The number 6 above takes the place value of a unit (1).

The number 3 above takes the place value of a tenth (1/10).

The number 5 above takes the place value of a hundredth (1/100).

c) Rounding

Numbers can be rounded off to the nearest place values, decimal points, significant digits/figures and the standard form.

i) Nearest Place Value

Round off 2678.35 to the nearest unit, ten, hundred and tenth.

Answer :

Unit = 2678 ten = 2680 hundred = 2700 tenth = 2678.4

ii) Decimal Point(Place)

Round off 2678.3555 to 1 dp and 2 dp.

Answer :

2678.4 (1dp) 2678.36 (2dp)

iii) Significant figure(digit)

Round off 2678.354 to 1sf, 2sf,3f,4sf and 5sf.

Answer :

3000(1sf) 2700(2sf) 2680(3sf) 2678(4sf) 2678.4(5sf)

iv) Standard Form

It takes the form of A x N10

where /A/ is unit.

Round off 234, 0.023 and -12.35 into the standard form.

Answer :

234 = 2.34 x 102 0.023 = 2.3x 10-2 -12.35 = -1.235 x 10

d) Conversion of fractions to decimals and to percentages and vice versa.

Numbers can take different forms just like water can be solid as ice, liquid as water and gas as steam.

Consider a fraction ½. It can be converted to a decimal as 0.5 and to a percentage as 50%.

e) Rounding off numbers

Numbers can be estimated to several forms in decimal points (dp), significant figures(sf) or a standard form (std)

For examples,

Round off 12.345 to :

i) 2 dp ii) 1dp iii)1sf iv)4sf v) std

Answers :

i) 12.35 ii) 12.3 iii) 10 iv) 12.35 v) 1.2345 x 104

Introduction to algebra

a. Using symbols

It is usual to put number in front of the letter.

3a means 3 * a or a + a + a

b. The laws of arithmetic are also true for algebra

Examples

Arithmetic Algebra

Addition is commutative 2+6=6+2 a+b=b+a

Multiplication is commutative 2*6=6*2 ab=ba

Addition is associative (2+4)+6 (a+b)+c

=2+(4+6) =a+(b+c)

Multiplication is associative (2*4)*6

=2*(4*6) (ab)c=a(bc)

Multiplication is distributive 2*(4+6) a(b+c)=ab+ac

over addition and subtraction. =2*4+2*6

c. Like Terms

Terms made up of exactly the same algebraic quantities, for eg., 2a2 , 5a2 and –a2 are like terms.

d. Multiplication and division

i) Calculate 3a*2b*2c

ii) Calculate 16a3b2 / 4ab

Answers : i) (3*2*2)(abc) = 12abc

ii) (16/4)a3-1b2-1 = 4a2b

Updated on 23 August 2006.

Describing an Expression using a flow diagram

Example 1

Flow Diagram for 6x + 3.

Example 2

Flow Diagram for 3xy.

Changing the subject of a formula

A formula may be rearranged so that a different letter becomes the subject.

Example 3

A = B * C where A is the subject.

To make C as the subject, C = A / B

Flow Diagram for C = A/B

Simplification of Algebraic Expressions

Example 4

a(b+ c) = ab + ac

Example 5

(x + a)(x + b) = x2 + ax + bx + ab

Factors

Numbers which can be divided into smaller whole number values will have factors. These smaller whole numbers are called factors. Any numbers which can be divided by themselves and 1 are PRIME NUMBERS.

Example 5

The positive factors for 12 is 1,2,3,4,6 and 12.

The negative factors for 12 is -1,-2,-3,-4,-6 and -12.

Example 6

The factors for 13 is 1 and 13. Thus, 13 is a prime number.

Solutions of simple linear equations.

Example 7

2x + 3 = 5

x = 1

Example 8

x + 1 = 4

x

x + 1 = 4x

3x = 1

x = 1/3

A) Place Value

i) Denary

A denary integer is a whole number in our usual system of ten(10) digits.

Hundred Ten Unit Tenth Hundredth

5 9 7. 2 3

The 5 above has a place value of hundred.

The 8 above has a place value of ten.

The 7 has a place value of unit.

The 2 has a place value of tenth.

The 3 has a place value of hundredth.

ii) Octal

An octal number has a system of 8 digits.

82 81 80 8-1 8-2

5 8 7 2 3

The 5 above has a place value of hundred.

The 8 above has a place value of ten.

The 7 has a place value of unit.

The 2 has a place value of tenth.

The 3 has a place value of hundredth.

iii) Hexadecimal

A hexadecimal number has a system of 16 digits.

162 161 160 16-1 16-2

A B C 1 2

The A above has a place value of 162

The B above has a place value of 161

The C above has a place value of 160

The 1 above has a place value of 16-1

The 2 above has a place value of 16-2

Introduction to Graph Plotting

Terminology

The y axis is the dependent variable(effect) and the x axis is the independent variable(cause).

Rules of drawing graphs :

a) Always give a title to the graph.

b) Label the dependent variable on the y axis and the independent variable on the x axis.

c) Label the axes clearly with the correct scale and units.

d) Use a fine point or cross for marking positions of values.

Cartesian Coordinates

Points can be plotted into the following quadrants :

At point A(3,2) means x = 3 and y = 2.

1) Matrix Representation

Coordinates as column matrices.

The coordinates in a column matrix is written as follows

Graph of a shape S, a quadrilateral of ABCD.

The matrix S is

2) XY Graphs

a) Linear equation (straight line)

We need two points to plot the straight line of y = a + bx.

Example 1: Plot y = 2x + 1

Choose x = 0, y = 2(0) + 1 = 1

Choose x = 1, y = 2(1) + 1 = 3

b) Simple Curves

Quadratic equation or parabola.

y= x2 + 1

x -1 -0 -1

y 2 1 2

1) Other Graphs

a) Pie Chart

The sales of products ABC are shown below:

Product Sales (units) Degree %

A 25 90 25

B 25 90 25

C 50 180 50

b) Bar Chart

Year Profit (RM Million)

1991 3.4

1992 4.2

1993 5.0

1994 5.4

1995 4.2

Data Structures

An organized collection of data is called a data structure.

Data values can be several types as explained below :

a) Integers

It is a whole number starting from 1 without fractional or decimal components.

Examples of integers are 1,2,3,4,5……….

b) Signed Integer

It is a whole number with a sign component.

Integer Formats

Type Range Format

Short Integer -128 to +127 Signed 8 bits

Integer -32768 to +32767 Signed 16 bits

Byte 0 to 255 Unsigned 8 bits

Word 0 to 65535 Unsigned 16 bits

c) Real Numbers

It includes all the integers and fractions of the number system.

Examples are 1, 2, 3.5, 6.9, 7/8, etc

d) Booleans

It allows only two values TRUE and FALSE

Examples : 2 > 3 is FALSE

3 < 6 is TRUE

i) Boolean Operations : NOT.

X NOT X

FALSE TRUE

TRUE FALSE

ii) Boolean Operations : AND

X Y X AND Y

F F F

F T F

T F F

T T T

iii) Boolean Operations : OR

X Y X OR Y

F F F

F T T

T F T

T T T

Examples of the operation above :

If A = 4 < 7 (True) AND B = 5 < 9 (FALSE), then the operation is FALSE.

If A = 4 < 7 (True) OR B = 5 < 9 (FALSE), then the operation is TRUE.

e) Characters

It contains a single character with 1 byte(8 bits) and is usually written inside quotation marks, for example : “Z” , “ – “

A. Compound Data Structures

i)Arrays

An array is a finite ordered list of elements of the same data type.

Table 1 : One dimensional array

12

34

45

2

3

Integer array of 5 elements. The array T above has row 1 to row 5. Thus we write the address and value as follows :

T[1] = 12 *

T[2] = 34

T[3] = 45

T[4] = 2

T[5] = 3

*The number [1] represents the address and the number 12 is the value or content.

Table 2 : Two dimensional array

12 23 45

4 6 8

23 56 67

7 2 89

The array T above has the following addresses and values :

T[1,1] = 12 . The first no 1 is row 1 and the second no 1 is column 1 for the address.

The value or content is 12.

T[1,2] = 23

T[1,3] = 45

T[2,1] = 4

T[2,2] = 6

T[2,3] = 8

T[3,1] = 23

T[3,2] = 56

T[3,3] = 67

T[4,1] = 7

T[4,2] = 2

T[4,3] = 89

ii) Records

A record consists of a number of related data items, but the data items, or fields, may have different data types.

Example:

A record to identify an employee may have the following fields :

PERSONNEL NUMBER could be a 8 character array.

NAME could be a 25 character array.

ADDRESS could be a 30 character array.

DATE OF BIRTH could be an integer.

iii) Tables

A table is an array of records.

Example :

PERSONNEL NUMBER NAME ADDRESS DATE OF BIRTH

0002345 A.B. TAN 2, JALAN GASING PJ 120163

0002346 K.T. CHAN 4, JALAN SS2/5

PJ 100175

0002347 ADMAD ABU 23 KAMPUNG KERINCHI KL 230380

0002348 CINDY CHEONG B02-3A MILLENNIUM APT. PJ 200782

B. LINKED LISTS

A linked list is a dynamic data structure. Data records may be inserted into the structure in any sequence, but they are usually accessed in sequence.

An example of a linked list of capital letters which is accessed alphabetically is shown below :

Order of entry of letters :

H J F C P L

(1) (2) (3) (4) (5) (6)

NODE DATA ITEM LINK

1 H 2

2 J 6

3 F 1

4 C 3

5 P 0

6 L 5

C. QUEUES

A queue is a First In First Out (FIFO) Data Structure. New elements may only be added at the end of the queue and elements may only be retrieved or deleted from the front of the queue.

Example linear queue

1 2 3 4 5

Front of queue

Four associated variables are required :

Limit = 5

Front = 1

End = 0

Size = 0

If three elements A ,B and C are added into the queue, then

1 2 3 4 5

A B C

Front of queue

Four associated variables are required :

Limit = 5

Front = 1

End = 3

Size = 3

If one element is deleted, then the first element A will be deleted first.

1 2 3 4 5

B C

Front of queue

Four associated variables are required :

Limit = 5

Front = 2

End = 3

Size = 2

Example circular queue

Consider a circular queue with 8 entries:

Limit = 8

Front = 1

End = 0

Size = 0

If three elements A, B and C are added into the queue,

Limit = 8

Front = 1

End = 3

Size = 3

If two elements are deleted, then the first two elements A and B will be deleted.

Limit = 8

Front = 3

End = 3

Size = 1

D. STACK

A stack is a Last In First Out (LIFO) data structure.

Consider a stack with 6 entries with the current three items stacked up as follows :

The associated variables are :

Top = 6

Pointer = 3

Bottom = 1

If one item D is added, then D will be stacked after C as follows :

The associated variables are :

Top = 6

Pointer = 4

Bottom = 1

If two items are deleted from the stack, then the last two items C and D

will be deleted as follows :

The associated variables are :

Top = 6

Pointer = 2

Bottom = 1

Subscribe to:
Post Comments (Atom)

## 0 comments:

Post a Comment