using System using System Collections Generic using System Linq using

 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
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static double f(double x)
{
return Math.Log(x) / (x * Math.Sqrt(1 + Math.Log(x)));
}
static double Fx(double x)
{
double z = Math.Sqrt(Math.Log(x) + 1);
return 2 * z * z * z / 3 - 2 * z + 4 / 4;
}
static double Trops(double a, double b, int n)
{
double s, x, h;
int i;
s = f(a) + f(b);
h = (b - a) / n;
x = a;
for (i = 1; i < n; i++)
{
x = x + n;
s = s + 2 * f(x);
}
return s * h / 2;
}
static double Simpson(double a, double b, int n)
{
double s, x, h;
int i, c;
s = f(a) + f(b);
h = (b - a) / n;
x = a;
c = 1;
for (i = 1; i < n; i++)
{
x = x + h;
s = s + (3 + c) * f(x);
c = -c;
}
return s * h / 3;
}
static void Main(string[] args)
{
}
}
}