Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static double Func(double x, double y)
- {
- return (x * x + y) / x;
- }
- static void Main(string[] args)
- {
- Console.Write("Введите нижнюю границу интегрирования(a): ");
- double a = double.Parse(Console.ReadLine());
- Console.Write("Введите верхнюю границу интегрирования(b): ");
- double b = double.Parse(Console.ReadLine());
- Console.Write("Введите начальное условие y(x0): ");
- double y0 = double.Parse(Console.ReadLine());
- Console.Write("Введите шаг интегрирования(h): ");
- double h = double.Parse(Console.ReadLine());
- Console.WriteLine("===================================================");
- Console.WriteLine("Метод Эйлера");
- Console.WriteLine("===================================================");
- Console.WriteLine("x\t\ty");
- double x = a;
- double y = y0;
- for (double i = a; i <= b; i += h)
- {
- x = i;
- Console.WriteLine("{0:F}\t\t{1:f3}", x, y);
- y = y + h * Func(x, y);
- }
- Console.ReadKey();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement