#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
double f(double t1,double t2)
{
double y;
y=t1*t2;
return y;
}
double cx(double x)
{
double y;
y=x;
return y;
}
double dx(double x)
{
double y;
y=2*x;
return y;
}
double Dblint(double a,double b,double m,double n)
{ double s1,s2,s3,k1,k2,k3;
double h,S,L,G;
double x,y,z;
h=(b-a)/(2*n);
cout<<"h="<<h<<endl;
s1=0;
s2=0;
s3=0;
cout<<"----------------------------------------------------------------"<<endl;
for(int i=0;i<=2*n;i++)
{
x=a+i*h;
G=(dx(x)-cx(x))/(2*m);
k1=f(x,cx(x))+f(x,dx(x));
cout<<setprecision(7);
cout<<"k1="<<k1<<setw(8)<<"G="<<G<<endl;
k2=0;
k3=0;
for(int j=1;j<=(2*m-1);j++)
{
y=cx(x)+j*G;
z=f(x,y);
if(j%2==0)
{
k2=k2+z;
}
else
{
k3=k3+z;
}
}
L=(k1+2*k2+4*k3)*(G/3);
if(i==0||i==2*m)
{ s1=s1+L; }
else if(i%2==0)
{ s2=s2+L; }
else
{ s3=s3+L; }
}
S=(s1+4*s3+2*s2)*(h/3);
return S;
}
int main()
{
double a,b,m,n,S;
cout<<"请输入区间a,b和等分数m,n:"<<endl;
cin>>a>>b>>m>>n;
S=Dblint(a,b,m,n);
cout<<"输出二重积分值:"<<flush;
cout<<"S="<<S<<endl;
return 0;
}
shuzhifenxi.rar_visual c
版权申诉
7 浏览量
2022-09-24
16:03:02
上传
评论
收藏 701B RAR 举报
![avatar](https://profile-avatar.csdnimg.cn/9116002996824fde940a716bee54aca8_weixin_42663213.jpg!1)
钱亚锋
- 粉丝: 90
- 资源: 1万+
最新资源
- 图标生成工具 Windows 版本(支持.ico和.icns)IconBuilder v1.1
- 666662222277777
- 图标生成工具 Mac 版本(支持.ico和.icns)IconBuilder v1.1
- 求最大公约数(简单).cpp
- elasticsearch数据库下载、配置、使用案例
- springboot的概要介绍与分析
- C语言的概要介绍与分析
- 第一个较大的Android项目,基于Android平台的图书管理系统(Android studio).zip
- Cisco Packet Tracer 6.2 for Windows Instructor Version
- 使⽤pyIAST计算⽓体吸附选择性
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)