ニュートン・ラフソン法
をテンプレートにして作成
[
トップ
|
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#ref(rf_newton.eq4.gif,nolink,70%)
#ref(rf_newton.eq7.gif,nolink,70%)
#ref(rf_newton.eq9.gif,nolink,70%)
#ref(rf_newton.eq11.gif,nolink,70%)
|&ref(newton.jpg,,100%);|
#code(C){{
/*!
*/
int newton(double func(const double), double dfunc(const ...
double &x, int &max_iter, double &eps)
{
double f, df, dx;
int k;
for(k = 0; k < max_iter; ++k){
f = func(x);
df = dfunc(x);
x = xn-f/df;
dx = fabs(f/df);
if(dx < eps || fabs(f) < eps){
max_iter = k; eps = dx;
return 1;
}
}
max_iter = k; eps = dx;
return 0;
}
}}
終了行:
#ref(rf_newton.eq4.gif,nolink,70%)
#ref(rf_newton.eq7.gif,nolink,70%)
#ref(rf_newton.eq9.gif,nolink,70%)
#ref(rf_newton.eq11.gif,nolink,70%)
|&ref(newton.jpg,,100%);|
#code(C){{
/*!
*/
int newton(double func(const double), double dfunc(const ...
double &x, int &max_iter, double &eps)
{
double f, df, dx;
int k;
for(k = 0; k < max_iter; ++k){
f = func(x);
df = dfunc(x);
x = xn-f/df;
dx = fabs(f/df);
if(dx < eps || fabs(f) < eps){
max_iter = k; eps = dx;
return 1;
}
}
max_iter = k; eps = dx;
return 0;
}
}}
ページ名: