FISH.





Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/virtwww/w_beloshenko-org-ua_e2c5fc46/http/topp.php on line 8

Warning: include(http://www.beloshenko.org.ua/panel.html) [function.include]: failed to open stream: no suitable wrapper could be found in /home/virtwww/w_beloshenko-org-ua_e2c5fc46/http/topp.php on line 8

Warning: include() [function.include]: Failed opening 'http://www.beloshenko.org.ua/panel.html' for inclusion (include_path='.:') in /home/virtwww/w_beloshenko-org-ua_e2c5fc46/http/topp.php on line 8







Solving equations numerically. Newton method. (FORTRAN)

Beloshenko + 2007
-------------------------------------------------------------- Newton.for -------------------------------------------------------------- program Newton c Solving equation f(x)=0 by Newton method. real a,b,eps real x0,x1,dx open(unit=1,name='data.txt',status='old') open(unit=2,name='res.txt',status='new') c a=-1.5 c b=1.5 c eps=0.001 c dx=0.001 read(1,3)a read(1,3)b read(1,3)eps read(1,3)dx 3 format(F5.3) x0=a x1=x0-f(x0)*dx/(f(x0+dx)-f(x0)) 1 if ((abs(x0-x1)).LE.eps) goto 2 x0=x1 x1=x0-f(x0)*dx/(f(x0+dx)-f(x0)) goto 1 2 continue write(2,4)x0 4 format(F5.3) close(2) close(1) stop end -------------------------------------------------------------- f.for function f(x) f=SIN(x)+x-1 return end -------------------------------------------------------------- Data.txt -1.5 1.5 0.001 0.001 -------------------------------------------------------------- res.txt 0.511 --------------------------------------------------------------





Click Here for Free Traffic!

FISH.