Computer's Little Tales- 3

Google+ Pinterest LinkedIn Tumblr +

The variables in algebra and in computer program-(A)

Here we should digress a little

To fully understand the use of “memory houses”

We know that main memory board is like a city

With hundreds of thousands of houses

All neatly connected by a maze

Of perpendicular and parallel roads.

Each memory house has eight or sixteen chambers

All in a row to make the memory house

Look like a long military barrack

The row of chambers are also generally interconnected

The manufacturer allots a “house number”

To every memory house just like the city municipality does.

But these “house numbers” are not directly used by us.

We recognize many buildings with special names

Such as hotel,school,hospital,cinema hall etc

But do not refer to them with their house numbers

Which are allotted by the municipality.

Similarly in the big city of “memory houses”

We select a few dozen “memory houses”

In a particular area of the main memory board

And give them formal names like X,Y and Z

These names are like the variables X,Y,Z in algebra.

We use to indicate unknown quantities.

In different problems the variables take different values.

X may denote 2 and 200 and 2000 in different problems.

Similarly in the memory houses selected by us

Different numbers may reside in different “computer programs”

In one program the number 2 lives in memory house x

In next program the number 9 lives there

And in still another program the number 27 lives there.

A simple program is so similar to an algebra problem

In mathematics we call it “problem”

And in computer lore we call it a “program”.

In small computer programs

We use just three or four memory houses

Or at the most a dozen memory houses.

However we may require a few more memory houses

As the program develops.

The CPU itself may use a few memory houses

To keep interim datawith out us even being aware.

In a computer program

The first thing we do is to “declare variables”

It means we identify some memory houses

And give them specific names like X,Y,Z.

In businessmen’s computers

They may declare the variables with names

“Salary”, “interest”, “profit”, “commission” etc!

In a cricketer’s computer the variables may be

“Runs”,”wickets”,”wide_balls” etc.

The computer does not mind in the least the very long names.

After declaring variables in algebra

We mention a formula to solve the problem.

In algebra the formula is generally very short

But in computer programs

We develop a process and so

There are generally a large number of steps

To explain the step by step procedure.

Perhaps a dozen steps sufficed

To develop an old time computerprogram.

But a few hundred or few thousand steps

May be required to write new programs.

There are very advanced and accurate rules

To control and ensure accuracy

In the structure of such long programs.

Any way solving a simple computer program

Is quite similar to an algebra problem.

Weshould in the beginning of program itself

Select separate memory houses

To accommodate the answers too.


About Author

Leave A Reply