using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Prueba2
{
class Program
{
static void Main(string[] args)
{
int i, imax = 0, n;
double error, y, x, h, emax = 0;
n = 8348;
x = 0.8;
h = 1;
for (i = 1; i <= n; i++)
{
h *= 0.25;
y = (Math.Tan(x + h) - Math.Tan(x)) / h;
error = Math.Abs((1/Math.Pow(Math.Cos((x - y)),2)));
Console.WriteLine("i={0}, h={1}, error={2}, y={3}", i, h, error, y);
if (error > emax)
{
emax = error;
imax = i;
}
}
Console.WriteLine("imax={0} emax={1}", imax, emax);
Console.ReadLine();
}
}
}