Ever since the first computer was developed in the early 1900's the computer has been using math to solve most of it's problems. The Arithmetic and Logical unit helps the computer solve some of these problems. All type of math can be solved on computer's which it uses.
A computer understands two states: on and off, high and low, and so on. Complex instructions can be written as a combination of these two states. To represent these two conditions mathematically, we can use the digits 1 and 0. Some simple mathematical operations, such as addition and subtraction, as well as the two's complement subtraction procedure used by most computer's.
Evaluating an Algebraic Function
It is frequently necessary to evaluate an expression, such as the one below, for several values of x.
First to start with developing the power's of x to perform the necessary multiplications by the coefficients, and finally produce the sum. The following steps are the way the computer "thinks" when it is calculating the equation.
- Select x
- Multiply x by x and store x2
- Multiply x2 by x and store x3
- Multiply x3 by x and store x4
- Multiply x by 6 and store 6x
- Multiply stored x2 by 5 and store 5x2
- Multiply stored x3 by 4 and store 4x3
- Multiply stored x4 by 6 and store 6x4
- Add 6x4
- Add 4x3
- Subtract 5x3
- Add 6x
- Add 4
Binary Coded Decimal
One of the most convenient conversions of decimal to binary coded decimal's is used today in present day computer's.
BCD(Binary Coded Decimal) is a combination of binary and decimal; that is each separate decimal digit is represented in binary form. For example the chart below represents the Binary and Decimal conversions.
BCD uses one of the above binary representations for each decimal digit of a given numeral. Each decimal digit is handled separately.
For example, the decimal 28 in binary is as follows:
(28)10 = (11100)2
The arrangement in BCD is as follows:
Each decimal digit is represented by a four-place binary number.
Direct Binary Addition
In binary arithmetic if one adds 1 and 1 the answer is 10.
The answer is not the decimal 10. It is one zero. There are only two binary digits in the binary system. Therefore when one adds 1 and 1, one gets the 0 and a carry of 1 to give 10.
Similarly, in the decimal system, 5 + 5 is equal to zero and a carry of 1. Here is an example of binary addition:
column 4 3 2 1
0 1 1 1
+ 0 1 1 1
1 1 1 0
I n column 1, 1+1=0 and a carry of 1. Column 2 now contains 1+1+1. This addition, 1+1=0 carry 1 and 0+1=1, is entered in the sum. Column 3 now also contains 1+1+1, which gives a carry of 1 to column 4. The answer to the next problem is found similarly.
1 0 0 1 1 0 1 1
+ 0 0 1 1 1 1 1 1
1 1 0 1 1 0 1 0
Direct Binary Subtraction
Although binary numbers may be subtracted directly from each other, it is easier from a computer design standpoint to use another method of subtraction called two's complement subtraction. This will be illustrated next. However direct binary subtraction will be discussed.
Direct Binary Subtraction is similar to decimal subtraction, except that when a borrow occurs, it complements the value of the number. Also that the value of the number of one depends on the column it is situated. The values increase according to the power series of 2: that is 20, 21,23, and so on, in columns 1, 2, 3 and so on. Hence, if you borrow from column 3 you are borrowing a decimal 4.
column 3 2 1
1 1 0
- 1 0 1
0 0 1
In the example a borrow had to be made from column 2, which changed its value to 0 while putting decimal 2 (or binary 11) in column 1. Therefore, after the borrow the subtraction in column 1
involved 2-1=1; in column 2 we had 0-0=0; and in column 3
If the next column contains a 0 instead of a 1 , then we must proceed to the next column until we find one with 1 from which we can borrow.
1 0 0 0
- 0 1 0 1
After the borrow from column 4,
0 1 1 (11)
- 0 1 0 1
0 0 1 1
Notice that a borrow from column 4 yields an 8(23). Changing column 3 to a 1 uses a 4, and column 2 uses a 2, thus leaving 2 of the 8 we borrowed to put in column 1.
0 1 1 0 0 0 1 0
- 0 0 0 1 0 1 1 1
After the first borrow:
0 1 1 0 0 0 0 (11)
- 0 0 0 1 0 1 1 1
After the second borrow (from column 6):
0 1 0 1 1 1 (11) (11)
- 0 0 0 1 0 1 1 1
0 1 0 0 1 0 1 1
These operations are stored in the computer's memory then performed in the computer's Arithmetic/Logic Unit in the CPU.
In computer's, it is very important to consider the error that may occur in the result of a calculation when numbers which approximate other numbers are used. This is important to the use of computer's because of computers are usually very long and involve long numbers.
It is possible to divide one number from another by successively subtracting the divisor from the dividend and counting number of the subtractions necessary to reduce the remainder to a number smaller than the divisor.
For example, to divide 24 by 6:
Number of Is remainder smaller subtractions than divisor?
- 6 1 No
- 6 2 No
- 6 3 No
- 6 4 Yes
This shows how the computer "thinks" when it is calculating a problem using the division operation.
Here is another example when there is a remainder.
For example to divide 27 by 5:
Number of Is remainder smaller
Subtractions than divisor?
- 5 1 No
- 5 2 No
- 5 3 No
- 5 4 No
- 5 5 Yes
Therefore 27 = 5, with a remainder of 2.
These two diagrams show the flow of thinking for the operation of division in a calculation.
Evaluating Trigonometric Relations
For many problems in mathematics, the relationships between the sides of a right triangle are important, and this, of course, may suggest a general definition of trigonometry. hat is,if a computer is available, how trigonometric functions can be done by hand. It is interesting to consider some of the features of this field from a computer-oriented point of view.
It is not necessary to consider the last three functions in the same sense as the first three because, if any one of the first three one can get, the last three one can get by the reciprocal of the first three.
Reference to the triangle above shows that:
tan A = a
and that tan A is related to sin A and cos A by the
sin A = a/c = a = tan A
cos A b/c b
Something similar is shown below using the Pythagorean
a2 + b2 = c2
and dividing by c2:
a2 + b2 = c2
c2 + c2 = c2.
Applications of Computer Math
Computer Math is used in various ways in the mathematics and scientific field. Many scientists use the computer math to calculate the equations and using formulas, there by making calculating on computer much faster. For mathematicians computer math can help mathematicians solve long and tedious problems, quickly and efficiently.
The introduction of computer's into the world's technology has drastically increased the amount of knowledge helped by the computer's. The different aspects of using computer math are virtually limitless.