Chapter1, Study notes of Food Science and Technology

Computer Theory

Typology: Study notes

2014/2015

Uploaded on 05/09/2015

kalir1
kalir1 🇵🇰

7 documents

1 / 35

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COMPUTATIONAL MODELS
Chapter No. 1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23

Partial preview of the text

Download Chapter1 and more Study notes Food Science and Technology in PDF only on Docsity!

COMPUTATIONAL MODELS

Chapter No. 1

What Is Computational

Model?

 The common basis of programming

language and computer architecture

is known as computational model.

 Provides higher level of abstraction

than the programming language and

the architecture.

 Computational model is the

combination of the above two.

What Is Computational

Model? cont’n

What is a computer program?

 (^) It is an executable representation of some algorithm designed to solve some real world problem.  (^) There are thus two elements to a computer program:  (^) Logic - what we what the program to achieve.  (^) Control - how we are going to achieve the end goal. ALGORITHM = LOGIC + CONTROL

Imperative Languages con’t

 Order of execution is crucial, commands

can only be understood in context of

previous computation due to side effects.

 Control is the responsibility of the

programmer.

 E.g ALGOL, Pascal, Ada and C

Functional Languages

 A program in a functional language consists of
a set of (possibly recursive) function definitions
and expression whose value is output as the
program's result.
 Functional languages are one kind of
declarative language.
 Declarative languages allow the programmer
to concentrate on the logic of an algorithm
(declarative languages are goal driven,control
is not the concern of the programmer)

Interpretation of the Concept of

a Computational Model

 (^) The computational model comprises of three sets of abstraction:

Computational Model

Basic Items of Computation Problem Description Model Execution Model

Basic Items of Computation

 This is the specification of the items the

computation refers to the kind

computations (operations) that can be

performed on them.

 E.g of items of computations are:

 data, objects or messages, arguments

and functions, elements of sets and

predicate declared on them.

Problem Description Style

 It specifies how the problems in a

particular computational model are

described.

Style

Procedural

Declarative

Procedural Style

 In a procedural style the algorithm for
solving the problem is stated. A particular
solution is then declared. (Imperative
languages uses procedural style)

int nfac (int n) { int fac = 1; if (n > 0) for ( int i = 2; i <= n; i++ ) fac = fac * i; return fac; }

Declarative Style

 (^) Functional style  (^) relationships are expressed using functions.  (^) E.g. (square (n) ( n n))*  (^) This is a function square,that express the relationship between the input n and the output value nn.  (^) Logic style  (^) relationships are declared using expressions known as clauses.  (^) E.g. square(N, M):- M is NN  (^) Clauses can be used to express both facts and rules.

Problem Description Method

 Procedural style

 (^) the problem description model states how a solution of the given problem has to described.

 Declarative style

 (^) the problem description model states how the problem itself has to be described.

Interpretation of the Execution

 (^) How to perform the computation?  (^) It relates to problem description method  (^) Problem description method and the interpretation of the computation mutually determines and presumes each other.  (^) In Von Neumann computational model, problem description is the sequence of instructions which specify data and sequence of control instructions and the execution of the given sequence of instructions is the interpretation of the computation.

Execution Semantics

 (^) A rule that prescribes how a single execution step is to be performed.  (^) The rule is associated with the chosen problem description method and how the execution of the computation is interpreted.