using System.Collections.Generic;
0.5 * (Math.Log( 56 ) - Math.Log( 2 )) -
21 * (Math.Log( 8.0 / 7.0 ) - Math.Log( 2 )) / 2;
static double func ( double t )
return (t + 12) / (t * t + 3 * t + 2);
static double m_LeftRectangles ( double a, double b, double h )
for (double i = a; i < b; i += h)
static double m_Runge ( double a, double b, double h )
return 2 * m_LeftRectangles( a, b, h / 2 ) - m_LeftRectangles( a, b, h );
static Tuple<double, double, double> get_R ( double a, double b, double h )
Math.Abs( I - m_LeftRectangles( a, b, h ) ),
Math.Abs( I - m_LeftRectangles( a, b, h/2 ) ),
Math.Abs( I - m_Runge( a, b, h ) ) );
public static void Main ( string[] args )
Console.WriteLine( "I = "+ I );
Console.WriteLine( get_R( a, b, 0.0001 ) );
var Vec = new List<Tuple<double, double, double>>();
for (uint i = 0; i < MaxN; i++)
Vec.Add( get_R( a, b, (b - a) / (Math.Pow( 2.0, i )) ) );
Console.WriteLine( Vec.Count );
for (int i = 0; i < MaxN; i++)
Console.WriteLine( Vec[i] );
Console.WriteLine( "Done ! " );