Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
sulu
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { Console.WriteLine("Лабраторная работа №1:"); Console.WriteLine("Метод половинного деления"); Console.WriteLine("============================"); Console.WriteLine("Исход. данние [a,b] = (-5,0)"); Console.WriteLine("x^3 - 3x +1 = 0"); Console.WriteLine("№ итерации \t a \t \t b \t \t x \t\t f(x)"); Console.WriteLine("-----------------------------------------------------"); double a = -5; double b = 0; double eps = 0.01; double c ; int i=0; while (b - a > eps) { c = (a+b)/2; if(f(a) * f(c) < 0) { b = c; }else { a = c ; } i++; Console.WriteLine("ит№:{0} a= {1} b= {2} x= {3} f(x)= {4}",i,a,b,c,f(c)); } } static double f(double x) { return Math.Pow(x,3)-(3*x) +1; //return (3*Math.Pow(x,2))-(2*x)-9; } } }
run
|
edit
|
history
|
help
0
Binary Search Recursive
C# enum flag comparison with bitwise operators
Using Events/Delegates to Subscribe To A Service - Emails
cte-like constructs in C#
problem 2
Function Tester
fracOp
Class Objects
TuplaDivWriteHexa
Morse code