中点加速求微

#include <iostream>
using namespace std;
void main()
{
float x,e,result;
float f(float x);
float romberg(float (*f)(float),float x,float e);
cout<<"输入自变量值:";
cin>>x;
cout<<"输入精度:";
cin>>e;
result=romberg(f,x,e);
cout<<"运算结果是:"<<result<<endl;
}
float romberg(float (*f)(float),float x,float e) [url=file://适/]file://适[/url]合于比较光滑的曲线求积
{
float t1,t2,h=1.0;
float g3(float x,float h);
for(t2=g3(x,h),t1=t2-e;t1-t2>=e || t2-t1>=e;h/=2)
  t1=t2,t2=g3(x,h);
return t2;
}
/********************************************/  [url=file://加/]file://加[/url]速公式
float g3(float x,float h)
{
float g2(float x,float h);
return (64*g2(x,h/2)-g2(x,h))/63;
}
float g2(float x,float h)
{
float g1(float x,float h);
return (16*g1(x,h/2)-g1(x,h))/15;
}
float g1(float x,float h)
{
float g(float x,float h);
return (4*g(x,h/2)-g(x,h))/3;
}
float g(float x,float h)
{
float f(float x);
return (f(x+h)-f(x-h))/2/h;
}
/**********************************************/
float f(float x)
{
return x*x;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值