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

Biseccion

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

Biseccion

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

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
double xi = 0.5;
double xu = 2;
double xr1 = xu;
double xr;
double fxi; //f(xi)
double fxr; //f(xr)
double res=0; // f(xi)*f(xr)
double ErrorA;
int contador = 0;

while (contador<3)
{

if (res > 0)
{
xi = xr1;
}
else
{
xu = xr1;
}

xr = (xi + xu) / 2;
fxi = System.Math.Log(xi * xi) - 0.7;
fxr = System.Math.Log(xr * xr) - 0.7;
res = fxi * fxr;

ErrorA = Math.Abs((xr - xr1) / xr) * 100;


// Console.WriteLine("Iteracion {1}:", contador);
Console.WriteLine(res + "\n");
xr1 = xr;
contador+=1;
}

Console.Read();

}
}
}

You might also like