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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace ConsoleApplication38
{
class Program
{
static void Main(string[] args)
{
double a = 0, b = 1, h, x = a;
int n = 100;
h = (b - a) / n;
double[] y1 = new double[n];
double[] y2 = new double[n];
double[] yp = new double[n];
y1[0] = 1/9;
y2[0] = -7/12;
Console.WriteLine("№\tx\t\tЭйлер\t\tПроверка");
for (int i = 1; i < n; i = i + 1)
{
x = x + h;
//Эйлер
y1[i] = y1[i - 1] + h * y2[i - 1];
y2[i] = y2[i - 1] + h * (x + 5 - 2 * y2[i - 1] + 3 * y1[i - 1]);
//Проверка
yp[i] = Math.Pow(Math.E, x / Math.E / Math.E) + Math.Pow(Math.E, -3 * x / 4) - x / 3 - 17 / 9;
if ((i == 9) || (i == 19) || (i == 29) || (i == 39) || (i == 49) || (i == 59) || (i == 69) || (i == 79) || (i == 89) || (i == 99))
{
Console.WriteLine("{0:f0}\t{1:f4}\t\t{2:f5}\t\t{3:f5}", i + 1, x, y1[i], yp[i]);
}
}
Console.ReadLine();
}
}
}