数值计算非线性方程的数值解法的C++程序.docVIP

  • 41
  • 0
  • 约5.78千字
  • 约 12页
  • 2018-01-01 发布于河南
  • 举报

数值计算非线性方程的数值解法的C++程序.doc

数值计算非线性方程的数值解法的C++程序 学数值计算方法写的实验程序,有各种解非线性方程的解法(二分法,简单迭代法,牛顿迭代法,弦截法等)的C++语言实现,还有调用gsl库函数的解法。要顺利编译需要安装并配置gsl库。编译方法(Ubuntu下): g++ nonline.cpp -o nonline -lm -lgsl -lgslcblas //非线性方程的迭代解法 #include iostream #include cmath #include vector #include cstdlib #include gsl/gsl_roots.h #include gsl/gsl_errno.h #include gsl/gsl_math.h //#include mylib/MyClock.h using namespace std; const double INF = 999999; //代表无限大 //定义方程的函数f(x) double f(double x) { return x*x*x - x - 1.0; } //定义给gsl函数使用的函数gf(x,NULL) double gf(double x, void * param) { return x*x*x - x - 1.0; } //定义迭代法的方程 double g(double x) { return p

文档评论(0)

1亿VIP精品文档

相关文档