Está en la página 1de 2

#METODO DE PUNTO FIJO MULTIVARIABLE

f1=function(x,m,z) 1-cos(x*m*z)

f2=function(x,m,z) 1-(1-x)^(0.25)-z*(0.05*z-0.15)

f3=function(x,m,z) 1+(x^2)+0.1*(m^2)-0.01*m

x=1

m=x

z=m

T=1*10^-4

E=1

i=0

cat("---------------------------------------------------------------------------\n")

cat(formatC( c("Iteracion","x","m","z","Error"),width = -16, format = "f", flag = " "), "\n")

cat("---------------------------------------------------------------------------\n")

cat(formatC( c((i), (x),(m),(z)), digits=5, width = -15, format = "f", flag = " "), "\n")

while(E>T){

i=i+1

x1=f1(x,m,z)

m1=f2(x,m,z)

z1=f3(x,m,z)

E=((x1-x)^2+(m1-m)^2+(z1-z)^2)^0.5

x=x1

m=m1

z=z1

cat(formatC( c((i),(x),(m),(z),(E)), digits=5, width = -15, format = "f", flag = " "), "\n")
}

cat("---------------------------------------------------------------------------\n")

print(paste("EL VALOR DE LA RAIZ ES:","x=",x,";m=",m,";z=",z,";EN LA ITERCION",i))

cat("---------------------------------------------------------------------------\n")

También podría gustarte