Al go ri tm os en Fort Fo rt ran Program algoritmo_de_biseccion Integer Nmax,i Real a, b, p, f, Tol Write(*,*)"--------------Algoritmo Write(*,*) "--------------Algoritmo de Biseccion------------" Write(*,*) Write (*,*)"" "" Write(*,*) Write (*,*)"Digite "Digite el rango a,b" Read (*,*) Read (*,*)a,b 0) Do while Do while (f(a)*f(b)> Write(*,*) Write (*,*)"Digite "Digite otro Read (*,*) Read (*,*)a,b End do End do
rango a,b"
Write(*,*)"Digite Write(*,*) "Digite la tolerancia" Read (*,*) Read (*,*)Tol Write(*,*)"Digite Write(*,*) "Digite el numero maximo de iteraciones" Read (*,*) Read (*,*)Nmax Write(*,*) Write (*,*)"la "la funcion a analizar es:f=3x^2-2x-5" i=1 Do while Do while ( < i
Program algoritmo_del_punto_fijo Integer Nmax,i Real p, h, Tol , g ,Xo,E Write(*,*)"--------------Algoritmo del metodo del punto fijo---------" Write(*,*)"" Write(*,*)"Digite el valor inicial Xo" Read (*,*)Xo Write(*,*)"Digite la tolerancia" Read (*,*)Tol Write(*,*)"Digite el numero maximo de iteraciones" Read (*,*)Nmax Write(*,*)"la funcion a analizar es:f(x)=3x^2-2x-5" Write(*,*)"Entoces g(x)=(2x+5)/(3x)" Write(*,*)"" E=Tol+1 i=1 Tol.AND.i Do while (h(Xo)/=0.AND.E> <=Nmax ) p=g(Xo) E=abs(p-Xo) Xo=p i=i+1 Write(*,*)"Xo=",Xo End do if(h(Xo)==0) Then Write (*,*)"... La raiz de la funcion es:" ,Xo pause else E
Function h(x) Real x,h h=3*x**2-2*x-5 Return End Function Function g(x) Real x,g g=(2*x+5)/(3*x) Return End Function
Program algoritmo_del_metodo_de_Newton_Raphson Integer Nmax,i Real p, f, Tol , g ,Xo ,X Write(*,*)"-------------Algoritmo del metodo de Newton Raphson ------" Write(*,*)"" Write(*,*)"Digite el valor inicial Xo" Read (*,*)Xo Write(*,*)"Digite la tolerancia" Read (*,*)Tol Write(*,*)"Digite el numero maximo de iteraciones" Read (*,*)Nmax Write(*,*)"la funcion a analizar es:f(x)=3x^2-2x-5" Write(*,*)"Entoces g(x)=6x-2" Write(*,*)"" i=1 i<=Nmax ) Do while ( X=Xo-f(Xo)/g(Xo) if(abs(X-Xo)
Function f(x) Real x,f f=3*x**2-2*x-5 Return End Function Function g(x) Real x,g g=6*x-2 Return End Function