Answer the question
In order to leave comments, you need to log in
The program does not output a number. What is the problem?
The program must find the roots of the equation by Newton's method
class Program
{
static void Main(string[] args)
{
const float e = 0.0001f;
float x, xLast, fx, _fx;
Console.WriteLine("Введите начальное приближение к корню");
x = Convert.ToSingle(Console.ReadLine());
do
{
fx = 2 * Convert.ToSingle(Math.Log(x) - 1 / x);
_fx = (2 / x) + (1 / x * x);
xLast = (-2 / x * x) - (2 / x * x * x);
Convert.ToDouble( x = xLast - fx / _fx);
}
while( Math.Abs(fx) > e);
Console.WriteLine( "Значение корня уравнения ={0} ", x);
Console.Read();
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question