Can you please tell me how to cast to the form x = f (x) in the method of simple iterations, if the function has the form x ^ 3 - 2 * x ^ 2 - 15 * x + 36?

  • But remember the condition of convergence of the method of simple iterations? - Harry
  • | 1-k * f `(x) | <1 - condition for convergence. And how to get x = f (x) from it? - Nico_99

1 answer 1

Okay, I wanted to bring you to thinking and understanding yourself, but alas - there is no time.

For such functions, you can build a new function as

enter image description here

Well, the easiest choice of a suitable function. enter image description here so that the condition of convergence is fulfilled -

enter image description here

Here, see for yourself:

#include <iostream> #include <iomanip> 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(xy) > 1e-7) { y = x; x = it(x); } cout << "x = " << x << endl; cout << "f(x) = " << f(x) << endl; } 
  • Thank you very much for your help :) - Nico_99
  • If you are satisfied - do not leave a pending question, accept the answer ... - Harry