0% found this document useful (0 votes)
38 views2 pages

Metodo de Muller.

This document defines functions to calculate the root of a function using the Muller's method. It defines a funcion() function to calculate the value of the function, a Muller() function that implements Muller's method to iteratively find the root, and a Main() function that gets user input for the initial guesses and parameters and calls Muller() to calculate the root. Muller's method works by iteratively estimating better approximations for the root using the function values and derivatives at up to 3 points, until the error is below a threshold or the maximum number of iterations is reached.

Uploaded by

Jeison Blanco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views2 pages

Metodo de Muller.

This document defines functions to calculate the root of a function using the Muller's method. It defines a funcion() function to calculate the value of the function, a Muller() function that implements Muller's method to iteratively find the root, and a Main() function that gets user input for the initial guesses and parameters and calls Muller() to calculate the root. Muller's method works by iteratively estimating better approximations for the root using the function values and derivatives at up to 3 points, until the error is below a threshold or the maximum number of iterations is reached.

Uploaded by

Jeison Blanco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

static double funcion(double x)

{
double funcion = Math.Pow(x, 3) - 13 * x - 12;

return funcion;
}

static double Muller(double X0, double X1, double X2, double


Eadm, double n)
{
double h0, h1, d0, d1, A, B, C, R, denom, h, X3;
int i = 1;
h0 = X1 - X0;
h1 = X2 - X1;
d0 = (funcion(X1) - funcion(X0)) / h0;
d1 = (funcion(X2) - funcion(X1)) / h1;
A = (d1 - d0) / (h1 + h0);
i = 3;

do
{
B = (A * h1) + d1;
C = funcion(X2);
R = Math.Sqrt(Math.Pow(B, 2) - (4 * A * C));

if (B + R > B - R)
{
denom = B + R;
}
else
{
denom = B - R;
}

h = (-2 * C) / (denom);
X3 = X2 + h;

if (Eadm > Math.Abs((X3-X2)/X3)*100)


{
Console.WriteLine();
Console.WriteLine("El Valor de La Raiz es: {0}", X3);
Console.WriteLine("Se obutvo para el porcentaje de
error: {0} en la iteracion numero {1}", Eadm, i);
goto id1;
}
X0 = X1;
X1 = X2;
X2 = X3;
h0 = X1 - X0;
h1 = X2 - X1;
d0 = (funcion(X1) - funcion(X0)) / h0;
d1 = (funcion(X2) - funcion(X1)) / h1;
A = (d1 - d0) / (h1 + h0);
i++;
}
while (i <= n);
Console.WriteLine("NeuN");
id1:
Console.ReadKey();
return X3;
}

static void Main(string[] args)


{
Console.WriteLine("****Metodo de Muller****");
Console.WriteLine("Ingrese X0");
double X0 = double.Parse(Console.ReadLine());
Console.WriteLine("Ingrese X1");
double X1 = double.Parse(Console.ReadLine());
Console.WriteLine("Ingrese X2");
double X2 = double.Parse(Console.ReadLine());
Console.WriteLine("Ingrese el Error relativo porcentual
deseado");
double Eadm = double.Parse(Console.ReadLine());
Console.WriteLine("Ingrese el numero de iteraciones que
desea");
double n = double.Parse(Console.ReadLine());

double raices = Muller(X0, X1, X2, Eadm, n);

You might also like