2,3141

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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();
}
}
}