⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 改进后的欧拉方法.cpp

📁 数值分析(计算方法):欧拉方法、高斯-赛德尔迭代法、拉格朗日及分段线性插值、龙贝格算法、牛顿下山法、选主元高斯消去法
💻 CPP
字号:
#include "iostream"
#include "iomanip"
using namespace std;

void main()
{double x0=0,y0=1,x1,y1,yp,yc,h;
int i,n;
cout<<"输入n:";
cin>>n;
cout<<"输入h:";
cin>>h;
i=1;
while(i<=n)
{x1=x0+h;
yp=y0+h*(y0-2*x0/y0);
yc=y0+h*(yp-2*x1/yp);
y1=(yp+yc)/2;
cout<<setprecision(8)<<x1<<' ';
cout<<setprecision(8)<<y1<<endl;
x0=x1;
y0=y1;
i++;
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -