
08.12.2008, 22:20
|
|
Познавший АНТИЧАТ
Регистрация: 09.06.2006
Сообщений: 1,359
Провел на форуме: 5301021
Репутация:
1879
|
|
_http://forum.sources.ru/index.php?showtopic=252282
и на Сипипи есть...
Код:
#include "iostream.h"
#include "math.h"
#include "stdlib.h"
double f(double x)
{
return pow(x, 3)+2*pow(x, 2)+3*x+5;
}
double df(double x)
{
return 3*pow(x, 2)+4*x+3;
}
int main()
{
double eps = 0.001;
double x = 0;
while( fabs(f(x)) > eps )
{
x = x - f(x)/df(x);
}
cout << x << endl;
system("pause");
return 0;
}
Последний раз редактировалось Ch3ck; 08.12.2008 в 22:26..
|
|
|