funct.c
来自「一些迭代求根法的C语言程序(简单迭代法、割线法、二分法等)些迭代求根法的C语言程」· C语言 代码 · 共 45 行
C
45 行
/* This file should be used together with bisection.c or FixedPointIter.c
* or steffensen.c,etc.
* please refer to these files for detailed information.
*
* Created by Xiaoke Yang, Nov.1,2007
* */
/* Modified by Xiaoke Yang, Nov.5,2007
* Modification
* Add another function df(x) and some notes
* End Modification
* */
/*DESCRIPTION: the function in equation f(x)=0, whose roots will be found*/
double f(double x){
/* return exp(x)+10*x-2;*/
double res;
/*the roots are 1,2,3,4,5*/
res=pow(x,5)-15*pow(x,4)+85*pow(x,3)-225*pow(x,2)+274*x-120;
return res;
}
/*DESCRIPTION: the right hand of the iterated form of f(x)=0, i.e. x=g(x)*/
double g(double x){
/* return exp(x)+11*x-2;*/
return pow((3*x+18),1.0/3);
}
/*DESCRIPTION: the right hand of the iterated form of f(x)=0, i.e. x=g(x)*/
double phi2(double x){
return log(10*x-2);
}
/*DESCRIPTION: the right hand of the iterated form of f(x)=0, i.e. x=g(x)*/
double phi3(double x){
return (2-exp(x))/10;
}
/*DESCRIPTION: the derivative of function f(x)*/
double df(double x){
double res;
res=x*x;
return res;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?