1 Star 0 Fork 0

范敬文/cpp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
4-6牛顿迭代法.cpp 374 Bytes
一键复制 编辑 原始数据 按行查看 历史
范敬文 提交于 2020-10-24 21:21 +08:00 . master
#include<iostream>
#include<cmath>
using namespace std;
double solut(double a,double b,double c,double d){
double x,x0,f,f1;
x=1;
do
{
x0=x;
f=((a*x0+b)*x0+c)*x0+d;
f1=(3*a*x0+2*b)*x0+c;
x=x0-f/f1;
}while(fabs(x-x0)>=1e-5);
return x;
}
int main(){
double a,b,c,d;
cin>>a>>b>>c>>d;
cout<<solut(a,b,c,d);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fan-jingwen/cpp.git
git@gitee.com:fan-jingwen/cpp.git
fan-jingwen
cpp
cpp
master

搜索帮助