==使用c/c++计算积分,计算积分的方法大致有以下几种:
使用计算机求解积分大多是机械积分求函数的积分。
- 左矩形
- 右矩形
- 中矩形
- 梯形积分
- Simpson积分
- Newton-Cotes公式
- 复合梯形
- 复合Simpson
- 复合Cotes
- Gauss公式
被积分的函数f1(x) = 3*x +1; 和 f2(x) = sin(x)/x;
//头文件
static double func(double x);
static double func1(double x);
double left_rect_Intege(double (*f)(double x),double low_limit, double up_limit);
double right_rect_Intege(double (*f)(double x),double low_limit, double up_limit);
double mid_rect_Intege(double (*f)(double x),double low_limit, double up_limit);
double trapezoid_Intege(double (*f)(double x), double low_limit, double up_limit);
double simpson_Intege(double (*f)(double x), double low_limit, double up_limit);
double newton_cotes_Intege(double (*f)(double x), double low_limit, double up_limit);
double gauss1_Intege(double (*f)(double x), double low_limit, double up_limit);
double gauss2_Intege(double (*f)(double x), double low_limit, double up_limit);
double gauss3_Intege(double (*f)(double x), double<