Vous êtes sur la page 1sur 11

COMPUTER SCIENCE AND

ENGINEERING
OBAFEMI AWOLOWO UNIVERSITY
ILE-IFE OSUN STATE
INTRODUCTION TO PROGRAMMING
CSC 202 PROJECT
SUBMITTED BY: ADEWOLE OLUWAFEMI
EBENEZER
SUBMITTED TO: DR ELUDIORA
SUBMITTED ON: 9TH OF MARCH 2015
MATRIC NO: CSC/2012/012
SYSTEM NUMBER 113

PURPOSE OF THE PROJECT


The main purpose of the project is to investigate the
limitations of the computer in performing computational tasks
using the evaluation of the integral function

I=1-11-x2 dx
as a case study with an exact value of
I= =1.57089632679
The integral function is the area under the semicircle of the radius of semicircle.
THE ANALYSIS OF THE PROJECT
The main idea of the question is to show how integral function can be evaluated on the
computer by dividing the domain of integration into a large number of N subsections of
width h=2/N each and then employing the Riemann definition of the integral

Nk=1hyk

I=lim

N-

where
y k=1-x2k

and

xk=(-1+hk)

Given above with N as the large number of integration (based on reasonable


approximation) which ranges from 1- and also the width h=2/N. this type of integral is
based on the Reimanns theorem which is given above .

Instead of taking N to , we take N to 100 and we see how it goes


using different algorithm and Fortran programming

DESIGN OF THE PROJECT


Using flowchart in designing the question
START

X = 0.0
Y = 0.0
h = 0.0
N = 0.0
I = 0.0
P=0

READ N

h = 2/N

DO p = 1

100

x = -1 + (h*p)

y = SQRT(1 (x*x))

I = I + (y*h)

WRITE I

STOP

FORTRAN PROGRAMMING FOR THE INTEGRAL


CALCULATION
Program integral_calculus
Real:: x ,y, h
Integer::power
h= 0
Do power=1, 100, 1
X= -1+ (0.02 * power)
Y= SQRT(1-(x*x))
h=h + (y*0.02)
WRITE(*,*)The integral is, h
End do
End program integral_calculus

SCREEN SHOOT OF THE FORTRAN PROGRAMMING


WHEN N=100

RESULT
Taking N as power which is 100, we get the integral to be
evaluated as 1.56914 while the exact value is
1.57089632679. Even though the value is close to the
original number, the program from Fortran couldnt get
the exact value of the which indicate that computer are

not infinitely accurate (that is the limitation of computer


in mathematical calculation).
SCREEN SHOT OF RESULT OF THE FORTRAN
PROGRAMMING WHEN N=100

By increasing the value of N beyond 100 to get more


accurate results, It was discovered that the maximum
value N could have is 2945 for which the integral is
evaluated to be 1.57079. This is much more closer and
accurate to the value gotten for N= 100 .

SCREEN SHOT OF THE FORTRAN PROGRAMMING


WHEN N=2945

SCREEN SHOT OF THE RESULT OF THE FORTRAN


PROGRAMING WHEN N=2945

It is observed that when N=2945, it gives 1.5709 which is


the lowest number among the numbers which equally
gives 1.5709. That is, when N= 3000, it gives the same
value and so on.

CONCLUSION
The calculated value for the area of the semicircle of
radius is equal to =1.57079632679. During my
calculation using the fortran programming, I realize that
the highest value for =1.57079 (2945) which is the
closest value to the original value of (despite
increasing the value of N). This clearly shows the
limitation of computer to arithmetic using Riemanns
definition or theory.
As a computer scientist, looking at the aspect of
computer program contribution to this project, I realize
that there is still some need to improve computer
efficiency( both in accuracy and speed) in order to give
more accurate result and a little bit more faster. This can
be achieved by more work in producing more integrated
microchip which read or load up in less than 1020 (and
above) seconds. This can be achieved with more research
and creativity in the field of computing.

Vous aimerez peut-être aussi