Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Метод би-секции
- using System;
- namespace ConsoleApplication2
- {
- class Program
- {
- static double f(double x)
- {
- x = Math.Pow(x, 4) - 8 * Math.Pow(x, 3) - (2 * x * x) - 3;
- return x;
- }
- static void Main(string[] args)
- {
- double a, b, c = 0.0, eps;
- Console.Write("Введите a: ");
- a = Convert.ToDouble(Console.ReadLine());
- Console.Write("Введите b: ");
- b = Convert.ToDouble(Console.ReadLine());
- Console.Write("Введите eps: ");
- eps = Convert.ToDouble(Console.ReadLine());
- do
- {
- c = (a + b) / 2;
- if ((f(a) * f(c)) > 0)
- a = c;
- else
- b = c;
- }
- while ((b-a) > 2 * eps);
- c = (a + b) / 2;
- Console.Write("Корень: ");
- Console.WriteLine(c);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment