Home computickets Algorithm Method of simple iterations

Algorithm Method of simple iterations

Author

Date

Category

Tell me please how to make the type x = f (x) in the method of simple iterations, if the function has the form x ^ 3 – 2 * x ^ 2 – 15 * x + 36? ​​

Okay, I wanted to bring you on reflections and understanding, but alas – no time.

For such functions, you can build a new feature as

Well, and the easiest selection of the suitable function so that the convergence condition was carried out –

Here, see for yourself:

# include & lt; iostream & gt;
#InClude & lt; Iomanip & gt;
Using Namespace STD;
Double IT (Double X)
{
Return ((2 * x-2) * x * x-36) / ((3 * x-4) * x-15);
}
Double F (Double X)
{
RETURN ((X-2) * X-15) * X + 36;
}
Int Main (Int Argc, Const Char * Argv [])
{
Double x = 10, y = 0;
While (ABS (X-Y) & GT; 1E-7)
{
y = x;
x = it (x);
}
COUT & LT; & LT; "X =" & lt; & lt; x & lt; & lt; Endl;
COUT & LT; & LT; "f (x) =" & lt; & lt; f (x) & lt; & lt; Endl;
}

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.