Está en la página 1de 3

PROGRAM MetodoBiseccion;

uses Crt;

var a,b,FA,FP,x,No,p,pol2:real;

var FAFP,pol:real;

var TOL,NegTOL,N,i,m integer;

const log2=0.301029995;

ln10=2.302585093;

begin

writeln('La ecuacion ea: x^4 -2x^3 - 4x^2 + 4x + 4= 0');

write('Ingrese el nivel de tolerancia, TOL = ');

readln(TOL);

Writeln('Ingress el valor de los extremos del intervalo [a,b]: ');

write ('valor as a, a= ')

read(a);

write ('valor as b, b= ');

read(b);

NegTOL:= (-1 * TOL);

No := (NegTOL+ (ln(b-a)/ln10))/(log2);

N:= round(No);

writeln;

ClrScr;

NegTOL:= (-1 * TOL);

No := (NegTOL+ (ln(b-a)/ln10))/(log2);

N:= round(No);

writeln;

writeln ('El numero as interacionea ea : N, N= ': 50,N);

writeln('Para la ecuacion x^4 -2x^3 - 4x^2 + 4x + 4= 0 ' :46);


writeln('en el intervalo: [':35, a:0:2,',',b:0:2,']');

writeln('___________________________________________________________________');

writeln('n':2, 'An':10,'Bn':10, 'Pn':12, 'f(An)':14, 'F(Bn)':14);

writeln('___________________________________________________________________');

m:=1;

i:=2;

pol:=x*x*x*x-2*x*x*x-4*x*x+4*x+4;

FA:=pol;

p:=(a+b)/2;

x:=p;

pol2:=x*x*x*x-2*x*x*x-4*x*x+4*x+4;

FP:=pol2;

writeln(m:2, a:12:6, b:12:6, p:12:6, FA:12:6, FP:15:6);

while i <= (N) do

begin

FAFP:=FA*FP;

if FP=0 then

begin

writeln('la funcion converge en p, p = ', p:0:6, FP:19:6);

i:=i+1;

end

else

if FAFP > 0 then

begin
FA:= FP;

a:=p;

p:=(a+b)/2;

x:=p;

pol2:=x*x*x*x-2*x*x*x-4*x*x+4*x+4;

FP := pol2;

writeln (i:2,a:12:6,b:12:6,p:12:6,FA:12:6,FP:15:6);

i:=i+1;

end

else

begin

b:=p

p:= (a+b)/2;

x:=p;

pol2:=x*x*x*x-2*x*x*x-4*x*x+4*x+4;

FP := pol2;

writeln (i:2,a:12:6,b:12:6,p:12:6,FA:12:6,FP:15:6);

i:=i+1;

end;

end;

end.

También podría gustarte