SlideShare a Scribd company logo
1 of 7
Jhon cleyber Vivas Banguera

                                 MÉTODOS NUMÉRICOS
1. MÉTODO DE BISECCIÓN

function y=f(h)
y=-12.4 + 10*(0.5*%pi*(1**2) -(1**2)*asin(h/1)-h*((1**2)-h**2)**0.5);
endfunction

function pn=biseccion(f, h0,h1,aprox)
i=1;
er(1)=100;
if f(h0)*f(h1) < 0
    ha(1)=h0;
    hb(1)=h1;
    pn(1)=(ha(1)+hb(1))/2;
    printf('Ite.tt hatt hbtt pntt f(pn)t Error n');
    printf('%2d t %11.7f t %11.7f t %11.7f t %11.7f n',i,ha(i),hb(i),pn(i),f(pn(i)));
    while abs(er(i)) >= aprox
      if f(ha(i))*f(pn(i))< 0
         ha(i+1)=ha(i);
         hb(i+1)=pn(i);
      end
      if f(ha(i))*f(pn(i))> 0
         ha(i+1)=pn(i);
         hb(i+1)=hb(i);
            end
      pn(i+1)=(ha(i+1)+hb(i+1))/2;
      er(i+1)=abs((pn(i+1)-pn(i))/(pn(i+1)));
      printf('%2d t %11.7f t %11.7f t %11.7f t %11.7f t %7.6f
n',i+1,ha(i+1),hb(i+1),pn(i+1),f(pn(i+1)),er(i+1));
      i=i+1;
   end
else
   printf('En el intervalo escogido, no existe una raiz');
end
endfunction
Jhon cleyber Vivas Banguera

                                        MÉTODOS NUMÉRICOS




2. MÉTODO DE NEWTON-RAPHSON

function y=f(x)
y=2*(x**3) + x- 1;
endfunction

function y=df(x)
y=6*x**2 + 1;
endfunction

function pn=newtonraphson(f, p0,aprox );
i=1;
er(1)=1;
pn(1)=p0;
while abs(er(i))>=aprox;
   pn(i+1)=pn(i)-f(pn(i))/df(pn(i));
   er(i+1)=abs((pn(i+1)-pn(i))/pn(i+1));
   i=i+1;
end
printf(' i t  pn(i)    Error aprox (i) n');
for j=1:i;
   printf('%2d t %11.7f t %7.6f n',j-1,pn(j),er(j));
end
endfunction
Jhon cleyber Vivas Banguera

                                        MÉTODOS NUMÉRICOS



3. ITERACIÓN DE PUNTO FIJO

function y=f(t)
y=300-80.425*t+201.0625*(1-2.718281828**(-(0.1)*t/0.25));
endfunction

function pn = puntofijo(f, p0,aprox)
i=1;
er(1)=1;
pn(1)=p0;
while abs(er(i))>=aprox;
   pn(i+1) = f(pn(i));
   er(i+1) = abs((pn(i+1)-pn(i))/pn(i+1));
   i=i+1;
end
printf(' i t pn(i)    Error aprox (i) n');
for j=1:i;
   printf('%2d t %11.7f t %7.7f n',j-1,pn(j),er(j));
end
endfunction
Jhon cleyber Vivas Banguera

                                             MÉTODOS NUMÉRICOS
4.

a-    EL MÉTODO DE NEWTON P0 = 1

function y=f(x)
y=4*cos(x)-2.718281828**(x);
endfunction

function y=df(x)
y=-4*sin(x)-2.718281828**(x);
endfunction

function pn=newtonraphson(p0,aprox);
i=1;
er(1)=1;
pn(1)=p0;
while abs(er(i))>=aprox;
   pn(i+1)=pn(i)-f(pn(i))/df(pn(i));
   er(i+1)=abs((pn(i+1)-pn(i))/pn(i+1));
   i=i+1;
end
printf(' i t  Pn(i)    Error aprox (i) n');
for j=1:i;
   printf('%2d t %11.7f t %7.15f n',j-1,pn(j),er(j));
end
endfunction

b) EL MÉTODO DE LA SECANTE

function y=g(x)
y=4*cos(x)-2.718281828**(x);
endfunction

function pn = secante(x0,x1,aprox)
j=2;
i=1;
pn(1)=x0;
pn(2)=x1;
er(i)=1;
while abs(er(i))>=aprox
  pn(j+1)=(pn(j-1)*f(pn(j))-pn(j)*f(pn(j-1)))/(f(pn(j))-f(pn(j-1)));
  er(i+1)=abs((pn(j+1)-pn(j))/pn(j+1));
  j=j+1;
  i=i+1;
end

printf(' i tt pn(i) tt Error aprox (i) n');
printf('%2d t %11.7f tt n',0,pn(1));

for k=2:j;
   printf('%2d t %11.7f t %7.8f n',k,pn(k),er(k-1));
end

endfunction
Jhon cleyber Vivas Banguera

                                            MÉTODOS NUMÉRICOS

5.
a- Aplique el método de la secante

function y=f(x)
y=x**2-6;
endfunction

function pn = secante(f, p0,p1,aprox)
j=2;
i=1;
pn(1)=p0;
pn(2)=p1;
er(i)=1;
while abs(er(i))>=aprox
  pn(j+1)=(pn(j-1)*f(pn(j))-pn(j)*f(pn(j-1)))/(f(pn(j))-f(pn(j-1)));
  er(i+1)=abs((pn(j+1)-pn(j))/pn(j+1));
  j=j+1;
  i=i+1;
end

printf(' i tt pn(i) t Error aprox (i) n');
printf('%2d t %11.7f t n',0,pn(1));

for k=2:j;
   printf('%2d t %11.7f t %7.7f n',k-1,pn(k),er(k-1));
end

endfunction
Jhon cleyber Vivas Banguera

                                      MÉTODOS NUMÉRICOS

b-   Aplique el método de la falsa posición

function y=f(x)
y= (x^2) - 6;
endfunction


function xn=falsaposicion(f, a1,b1,max1)
i=1;
ea(1)=100;

// xn vector que almacena la {xn} completa
// ea error aproximado
// i número de iteraciones realizadas
// f función de iteración
// a1 es el punto de partida o el intervalo a1 que luego se le asignara a x0
// b1 es el punto de partida o el intervalo a1 que luego se le asignara a x1
// max1 se utiliza para ajustar la exactitud de la aproximación


if f(a1)*f(b1) < 0
    x0(1)=a1;
    x1(1)=b1;
    xn(1)=x0(1)-f(x0(1))*(x1(1)-x0(1))/(f(x1(1))-f(x0(1)));
    printf('It.tt X0tt xntt X1t Error n');
   printf('%2d t %11.7f t %11.7f t %11.7f n',i,x0(i),xn(i),x1(i));
    while abs(ea(i))>=max1,
     if f(x0(i))*f(xn(i))< 0
        x0(i+1)=x0(i);
        x1(i+1)=xn(i);
     end
     if f(x0(i))*f(xn(i))> 0
        x0(1)=xn(i);
        x1(1)=x1(i);
             end
     xn(i+1)=x0(i+1)-f(x0(i+1))*(x1(i+1)-x0(i+1))/(f(x1(i+1))-f(x0(i+1)));
      ea(i+1)=abs((xn(i+1)-xn(i))/(xn(i+1)));
     printf('%2d t %11.7f t %11.7f t %11.7f t %7.7f n', i+1,x0(i+1),xn(i+1),x1(i+1),ea(i+1));
     i=i+1;
   end
else
   printf('No existe una raiz en ese intervalo');
end
endfunction
Jhon cleyber Vivas Banguera

                            MÉTODOS NUMÉRICOS

c- La raíz de 6 = 2.449489742

   Como podemos ver tanto por el método de la secante, como por el método de la falsa
   posición se obtiene un grado alto de aproximación a la raíz del numero 6; pero
   comparando cada expresión decimal producida por cada método, podemos determinar que
   el método que más se acerca es el de la secante.

More Related Content

What's hot

Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...
Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...
Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...Fajar Perdana
 
Practica 4 errores
Practica 4 erroresPractica 4 errores
Practica 4 erroresUVM
 
openFrameworks基礎 動きを生みだす、アニメーション入門 - 芸大グラフィックスプログラミング演習B
openFrameworks基礎 動きを生みだす、アニメーション入門 - 芸大グラフィックスプログラミング演習BopenFrameworks基礎 動きを生みだす、アニメーション入門 - 芸大グラフィックスプログラミング演習B
openFrameworks基礎 動きを生みだす、アニメーション入門 - 芸大グラフィックスプログラミング演習BAtsushi Tadokoro
 
Luis cuñas programacion
Luis cuñas programacionLuis cuñas programacion
Luis cuñas programacionluisitofranklin
 
Hace una calculadora en jeank
Hace una calculadora en jeankHace una calculadora en jeank
Hace una calculadora en jeankHumbertoWuwu
 
An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]Eleanor McHugh
 
[KOSSA] C++ Programming - 14th Study - template
[KOSSA] C++ Programming - 14th Study - template[KOSSA] C++ Programming - 14th Study - template
[KOSSA] C++ Programming - 14th Study - templateSeok-joon Yun
 
openFrameworks、プログラムの制御構造の基本 - 多摩美メディアアートII
openFrameworks、プログラムの制御構造の基本 - 多摩美メディアアートIIopenFrameworks、プログラムの制御構造の基本 - 多摩美メディアアートII
openFrameworks、プログラムの制御構造の基本 - 多摩美メディアアートIIAtsushi Tadokoro
 
[C++ Korea] Effective Modern C++ Study, Item 27, 29 - 30
[C++ Korea] Effective Modern C++ Study, Item 27, 29 - 30[C++ Korea] Effective Modern C++ Study, Item 27, 29 - 30
[C++ Korea] Effective Modern C++ Study, Item 27, 29 - 30Chris Ohk
 
openFrameworks 動きを生みだす様々なアルゴリズム - 多摩美メディアアートII
openFrameworks 動きを生みだす様々なアルゴリズム - 多摩美メディアアートIIopenFrameworks 動きを生みだす様々なアルゴリズム - 多摩美メディアアートII
openFrameworks 動きを生みだす様々なアルゴリズム - 多摩美メディアアートIIAtsushi Tadokoro
 

What's hot (19)

Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...
Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...
Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...
 
Includes
IncludesIncludes
Includes
 
1er parcial funciones
1er parcial funciones1er parcial funciones
1er parcial funciones
 
Practica 4 errores
Practica 4 erroresPractica 4 errores
Practica 4 errores
 
openFrameworks基礎 動きを生みだす、アニメーション入門 - 芸大グラフィックスプログラミング演習B
openFrameworks基礎 動きを生みだす、アニメーション入門 - 芸大グラフィックスプログラミング演習BopenFrameworks基礎 動きを生みだす、アニメーション入門 - 芸大グラフィックスプログラミング演習B
openFrameworks基礎 動きを生みだす、アニメーション入門 - 芸大グラフィックスプログラミング演習B
 
Program brian
Program brianProgram brian
Program brian
 
Rafael vasquez
Rafael vasquezRafael vasquez
Rafael vasquez
 
Luis cuñas programacion
Luis cuñas programacionLuis cuñas programacion
Luis cuñas programacion
 
Vcs12
Vcs12Vcs12
Vcs12
 
Hace una calculadora en jeank
Hace una calculadora en jeankHace una calculadora en jeank
Hace una calculadora en jeank
 
Chuong10
Chuong10Chuong10
Chuong10
 
An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]
 
Clear all
Clear allClear all
Clear all
 
[KOSSA] C++ Programming - 14th Study - template
[KOSSA] C++ Programming - 14th Study - template[KOSSA] C++ Programming - 14th Study - template
[KOSSA] C++ Programming - 14th Study - template
 
openFrameworks、プログラムの制御構造の基本 - 多摩美メディアアートII
openFrameworks、プログラムの制御構造の基本 - 多摩美メディアアートIIopenFrameworks、プログラムの制御構造の基本 - 多摩美メディアアートII
openFrameworks、プログラムの制御構造の基本 - 多摩美メディアアートII
 
[C++ Korea] Effective Modern C++ Study, Item 27, 29 - 30
[C++ Korea] Effective Modern C++ Study, Item 27, 29 - 30[C++ Korea] Effective Modern C++ Study, Item 27, 29 - 30
[C++ Korea] Effective Modern C++ Study, Item 27, 29 - 30
 
Assignment
AssignmentAssignment
Assignment
 
Menu orastat.c
Menu orastat.cMenu orastat.c
Menu orastat.c
 
openFrameworks 動きを生みだす様々なアルゴリズム - 多摩美メディアアートII
openFrameworks 動きを生みだす様々なアルゴリズム - 多摩美メディアアートIIopenFrameworks 動きを生みだす様々なアルゴリズム - 多摩美メディアアートII
openFrameworks 動きを生みだす様々なアルゴリズム - 多摩美メディアアートII
 

Viewers also liked

New open document presentation
New open document presentationNew open document presentation
New open document presentationNotlim Oinamo
 
Nom, nym mnemonics cara
Nom, nym mnemonics caraNom, nym mnemonics cara
Nom, nym mnemonics caraCara9
 
3 Day Outlook And Weather Symbols Template
3 Day Outlook And Weather Symbols Template3 Day Outlook And Weather Symbols Template
3 Day Outlook And Weather Symbols TemplateMWF2009
 
Peikestolem el pulpito
Peikestolem el pulpitoPeikestolem el pulpito
Peikestolem el pulpitoDetodoconNinos
 
AVON Ukraine 17/2014 mini (Holodyk)
AVON Ukraine 17/2014 mini (Holodyk)AVON Ukraine 17/2014 mini (Holodyk)
AVON Ukraine 17/2014 mini (Holodyk)Dmitriy Machushenko
 
зөвөлгөө 3
зөвөлгөө 3зөвөлгөө 3
зөвөлгөө 3duya21
 
What You Need To Know About Health Insurance
What You Need To Know About Health InsuranceWhat You Need To Know About Health Insurance
What You Need To Know About Health InsuranceNupur Das
 
ERS presentation in Vietnamese
ERS presentation in VietnameseERS presentation in Vietnamese
ERS presentation in VietnameseYevo International
 
637121main scott presentation
637121main scott presentation637121main scott presentation
637121main scott presentationClifford Stone
 
Sampling exercises
Sampling exercisesSampling exercises
Sampling exercisesnaranbatn
 
HHH Capital Improvement Proposition Vote
HHH Capital Improvement Proposition VoteHHH Capital Improvement Proposition Vote
HHH Capital Improvement Proposition VoteE Robertson
 
AVON Ukraine 163/2014 mini (Holodyk)
AVON Ukraine 163/2014 mini (Holodyk)AVON Ukraine 163/2014 mini (Holodyk)
AVON Ukraine 163/2014 mini (Holodyk)Dmitriy Machushenko
 
Презентація з Конгресу громадянської Платформи Нова Країна
Презентація з Конгресу громадянської Платформи Нова КраїнаПрезентація з Конгресу громадянської Платформи Нова Країна
Презентація з Конгресу громадянської Платформи Нова КраїнаДмитрий Лубкин
 

Viewers also liked (20)

New open document presentation
New open document presentationNew open document presentation
New open document presentation
 
Nom, nym mnemonics cara
Nom, nym mnemonics caraNom, nym mnemonics cara
Nom, nym mnemonics cara
 
Dcef map
Dcef mapDcef map
Dcef map
 
3 Day Outlook And Weather Symbols Template
3 Day Outlook And Weather Symbols Template3 Day Outlook And Weather Symbols Template
3 Day Outlook And Weather Symbols Template
 
Amores VãOs
Amores VãOsAmores VãOs
Amores VãOs
 
Peikestolem el pulpito
Peikestolem el pulpitoPeikestolem el pulpito
Peikestolem el pulpito
 
AVON Ukraine 17/2014 mini (Holodyk)
AVON Ukraine 17/2014 mini (Holodyk)AVON Ukraine 17/2014 mini (Holodyk)
AVON Ukraine 17/2014 mini (Holodyk)
 
зөвөлгөө 3
зөвөлгөө 3зөвөлгөө 3
зөвөлгөө 3
 
What You Need To Know About Health Insurance
What You Need To Know About Health InsuranceWhat You Need To Know About Health Insurance
What You Need To Know About Health Insurance
 
ERS presentation in Vietnamese
ERS presentation in VietnameseERS presentation in Vietnamese
ERS presentation in Vietnamese
 
Mito narcisoequipo6
Mito narcisoequipo6Mito narcisoequipo6
Mito narcisoequipo6
 
I am making omlette
I am making omletteI am making omlette
I am making omlette
 
E – rate
E – rateE – rate
E – rate
 
15 mei ukraine - 28 october 2013
15 mei  ukraine - 28 october 201315 mei  ukraine - 28 october 2013
15 mei ukraine - 28 october 2013
 
637121main scott presentation
637121main scott presentation637121main scott presentation
637121main scott presentation
 
Harry
HarryHarry
Harry
 
Sampling exercises
Sampling exercisesSampling exercises
Sampling exercises
 
HHH Capital Improvement Proposition Vote
HHH Capital Improvement Proposition VoteHHH Capital Improvement Proposition Vote
HHH Capital Improvement Proposition Vote
 
AVON Ukraine 163/2014 mini (Holodyk)
AVON Ukraine 163/2014 mini (Holodyk)AVON Ukraine 163/2014 mini (Holodyk)
AVON Ukraine 163/2014 mini (Holodyk)
 
Презентація з Конгресу громадянської Платформи Нова Країна
Презентація з Конгресу громадянської Платформи Нова КраїнаПрезентація з Конгресу громадянської Платформи Нова Країна
Презентація з Конгресу громадянської Платформи Нова Країна
 

Metodos Numericos(Segundo Taller De Aplicadas)

  • 1. Jhon cleyber Vivas Banguera MÉTODOS NUMÉRICOS 1. MÉTODO DE BISECCIÓN function y=f(h) y=-12.4 + 10*(0.5*%pi*(1**2) -(1**2)*asin(h/1)-h*((1**2)-h**2)**0.5); endfunction function pn=biseccion(f, h0,h1,aprox) i=1; er(1)=100; if f(h0)*f(h1) < 0 ha(1)=h0; hb(1)=h1; pn(1)=(ha(1)+hb(1))/2; printf('Ite.tt hatt hbtt pntt f(pn)t Error n'); printf('%2d t %11.7f t %11.7f t %11.7f t %11.7f n',i,ha(i),hb(i),pn(i),f(pn(i))); while abs(er(i)) >= aprox if f(ha(i))*f(pn(i))< 0 ha(i+1)=ha(i); hb(i+1)=pn(i); end if f(ha(i))*f(pn(i))> 0 ha(i+1)=pn(i); hb(i+1)=hb(i); end pn(i+1)=(ha(i+1)+hb(i+1))/2; er(i+1)=abs((pn(i+1)-pn(i))/(pn(i+1))); printf('%2d t %11.7f t %11.7f t %11.7f t %11.7f t %7.6f n',i+1,ha(i+1),hb(i+1),pn(i+1),f(pn(i+1)),er(i+1)); i=i+1; end else printf('En el intervalo escogido, no existe una raiz'); end endfunction
  • 2. Jhon cleyber Vivas Banguera MÉTODOS NUMÉRICOS 2. MÉTODO DE NEWTON-RAPHSON function y=f(x) y=2*(x**3) + x- 1; endfunction function y=df(x) y=6*x**2 + 1; endfunction function pn=newtonraphson(f, p0,aprox ); i=1; er(1)=1; pn(1)=p0; while abs(er(i))>=aprox; pn(i+1)=pn(i)-f(pn(i))/df(pn(i)); er(i+1)=abs((pn(i+1)-pn(i))/pn(i+1)); i=i+1; end printf(' i t pn(i) Error aprox (i) n'); for j=1:i; printf('%2d t %11.7f t %7.6f n',j-1,pn(j),er(j)); end endfunction
  • 3. Jhon cleyber Vivas Banguera MÉTODOS NUMÉRICOS 3. ITERACIÓN DE PUNTO FIJO function y=f(t) y=300-80.425*t+201.0625*(1-2.718281828**(-(0.1)*t/0.25)); endfunction function pn = puntofijo(f, p0,aprox) i=1; er(1)=1; pn(1)=p0; while abs(er(i))>=aprox; pn(i+1) = f(pn(i)); er(i+1) = abs((pn(i+1)-pn(i))/pn(i+1)); i=i+1; end printf(' i t pn(i) Error aprox (i) n'); for j=1:i; printf('%2d t %11.7f t %7.7f n',j-1,pn(j),er(j)); end endfunction
  • 4. Jhon cleyber Vivas Banguera MÉTODOS NUMÉRICOS 4. a- EL MÉTODO DE NEWTON P0 = 1 function y=f(x) y=4*cos(x)-2.718281828**(x); endfunction function y=df(x) y=-4*sin(x)-2.718281828**(x); endfunction function pn=newtonraphson(p0,aprox); i=1; er(1)=1; pn(1)=p0; while abs(er(i))>=aprox; pn(i+1)=pn(i)-f(pn(i))/df(pn(i)); er(i+1)=abs((pn(i+1)-pn(i))/pn(i+1)); i=i+1; end printf(' i t Pn(i) Error aprox (i) n'); for j=1:i; printf('%2d t %11.7f t %7.15f n',j-1,pn(j),er(j)); end endfunction b) EL MÉTODO DE LA SECANTE function y=g(x) y=4*cos(x)-2.718281828**(x); endfunction function pn = secante(x0,x1,aprox) j=2; i=1; pn(1)=x0; pn(2)=x1; er(i)=1; while abs(er(i))>=aprox pn(j+1)=(pn(j-1)*f(pn(j))-pn(j)*f(pn(j-1)))/(f(pn(j))-f(pn(j-1))); er(i+1)=abs((pn(j+1)-pn(j))/pn(j+1)); j=j+1; i=i+1; end printf(' i tt pn(i) tt Error aprox (i) n'); printf('%2d t %11.7f tt n',0,pn(1)); for k=2:j; printf('%2d t %11.7f t %7.8f n',k,pn(k),er(k-1)); end endfunction
  • 5. Jhon cleyber Vivas Banguera MÉTODOS NUMÉRICOS 5. a- Aplique el método de la secante function y=f(x) y=x**2-6; endfunction function pn = secante(f, p0,p1,aprox) j=2; i=1; pn(1)=p0; pn(2)=p1; er(i)=1; while abs(er(i))>=aprox pn(j+1)=(pn(j-1)*f(pn(j))-pn(j)*f(pn(j-1)))/(f(pn(j))-f(pn(j-1))); er(i+1)=abs((pn(j+1)-pn(j))/pn(j+1)); j=j+1; i=i+1; end printf(' i tt pn(i) t Error aprox (i) n'); printf('%2d t %11.7f t n',0,pn(1)); for k=2:j; printf('%2d t %11.7f t %7.7f n',k-1,pn(k),er(k-1)); end endfunction
  • 6. Jhon cleyber Vivas Banguera MÉTODOS NUMÉRICOS b- Aplique el método de la falsa posición function y=f(x) y= (x^2) - 6; endfunction function xn=falsaposicion(f, a1,b1,max1) i=1; ea(1)=100; // xn vector que almacena la {xn} completa // ea error aproximado // i número de iteraciones realizadas // f función de iteración // a1 es el punto de partida o el intervalo a1 que luego se le asignara a x0 // b1 es el punto de partida o el intervalo a1 que luego se le asignara a x1 // max1 se utiliza para ajustar la exactitud de la aproximación if f(a1)*f(b1) < 0 x0(1)=a1; x1(1)=b1; xn(1)=x0(1)-f(x0(1))*(x1(1)-x0(1))/(f(x1(1))-f(x0(1))); printf('It.tt X0tt xntt X1t Error n'); printf('%2d t %11.7f t %11.7f t %11.7f n',i,x0(i),xn(i),x1(i)); while abs(ea(i))>=max1, if f(x0(i))*f(xn(i))< 0 x0(i+1)=x0(i); x1(i+1)=xn(i); end if f(x0(i))*f(xn(i))> 0 x0(1)=xn(i); x1(1)=x1(i); end xn(i+1)=x0(i+1)-f(x0(i+1))*(x1(i+1)-x0(i+1))/(f(x1(i+1))-f(x0(i+1))); ea(i+1)=abs((xn(i+1)-xn(i))/(xn(i+1))); printf('%2d t %11.7f t %11.7f t %11.7f t %7.7f n', i+1,x0(i+1),xn(i+1),x1(i+1),ea(i+1)); i=i+1; end else printf('No existe una raiz en ese intervalo'); end endfunction
  • 7. Jhon cleyber Vivas Banguera MÉTODOS NUMÉRICOS c- La raíz de 6 = 2.449489742 Como podemos ver tanto por el método de la secante, como por el método de la falsa posición se obtiene un grado alto de aproximación a la raíz del numero 6; pero comparando cada expresión decimal producida por cada método, podemos determinar que el método que más se acerca es el de la secante.