using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static double f(double x)
{
return Math.Asin(Math.Sqrt(1 / (1 + x)));
}
static double F(double x)
{
return x * Math.Asin(Math.Sqrt(x / (1 + x))) - Math.Sqrt(x) + Math.Atan(Math.Sqrt(x));
}
static double Simpson(double a, double b, int n)
{
double s, x, h;
s = f(a) + f(b);
h = (b - a) / n;
x = a + h;
do
{
x = x + h;
s = s + 2 * F(x);
}
while (x < b);
return h / 3 * (s + F(3) - F(0));
}
static void Main(string[] args)
{
double Int;
Int = Simpson(0, 3, 36);
Console.WriteLine("Интеграл = {0:f4}", Int);
Console.ReadKey();
}
}
}