FISH.




Nikita Beloshenko

Create Your Badge



Shop (under construction).







Чисельний розв'язок рівняння. Метод дихотомії. (Фортран)

Beloshenko + 2007

------------------------------------------------------------------------------
dichotom.for

program Dichotom
real a,c,b,eps
open(unit=1, file='Data.txt', status='old')
open(unit=2, file='Res.txt', status='new')
read(1,2)a
read(1,2)b
2 format(f4.2)

eps=0.001

if (f(a)*f(b).GE.0) goto 1

4 if ((b-a).LE.eps) goto 3
c=(b+a)/2
if (f(c)*f(b).GE.0) goto 6
a=c
goto 4
6 b=c
goto 4
3 continue write(2,5)a
5
format(f5.3)
close(2)
close(1)
1
stop end
------------------------------------------------------------------------------ f.for function f(x)
f=SIN(x)+x-1
return end ------------------------------------------------------------------------------ Res.txt 0.511 ------------------------------------------------------------------------------ Data.txt -0.1 1.1





Click Here for Free Traffic!

FISH.