我要加入 登录
声振论坛 返回首页

vibraman的个人空间 http://home.vibunion.com/?5962 [收藏] [复制] [分享] [RSS]

日志

高斯10点法求积

已有 806 次阅读2006-12-23 11:16

天气: 晴朗
心情: 高兴

double gauss_legendre(double(*f)(double),double a,double b)
{
const int n=10;
const double z[10]={-0.9739065285,-0.8650633677,-0.6794095683,
-0.4333953941,-0.1488743390,0.1488743390,
0.4333953941,0.6794095683,0.8650633677,
0.9739065285};
const double w[10]={0.0666713443,0.1494513492,0.2190863625,
0.2692667193,0.2955242247,0.2955242247,
0.2692667193,0.2190863625,0.1494513492,
0.0666713443};
double y,gg;
int i;
gg=0.0;
for(i=0;i<n;i++)
{
y=(z[i]*(b-a)+a+b)/2.0;
gg+=w[i]*(*f)((double)y);
}
return((double)((gg*(b-a)/2.0)));
}
[/code]

作者:山城棒棒儿

 

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 我要加入

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-24 23:41 , Processed in 0.036136 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部