当前位置:网站首页>Newton iterative method (solving nonlinear equations)
Newton iterative method (solving nonlinear equations)
2022-07-05 09:06:00 【Stop AC】
principle
For known equations f(x), When f’(x)=n, Into f(x)-n=0;
subject
#include<bits/stdc++.h>
#define ll long long
#define PI 3.141592653589793
#define E 2.718281828459045
#define HalF (l + r)>>1
#define lsn rt<<1
#define rsn rt<<1|1
#define Lson lsn, l, mid
#define Rson rsn, mid+1, r
#define QL Lson, ql, qr
#define QR Rson, ql, qr
#define myself rt, l, r
#define mset(a,b) memset(a,b,sizeof(a))
#define mcpy(a,b) memset(a,b,sizeof(a))
#define FOR( i , a , b ) for ( int i = a ; i <= b ; ++ i )
#define FO( i , n ) for ( int i = 0 ; i < n ; ++ i )
#define lowbit(a) ((a)&-(a))
#define PII pair<ll ,ll >
#define ft first
#define sd second
#define endl "\n"
typedef unsigned long long ull;
const ll mod=10007;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll Max=1e5+10;
using namespace std;
ll t,n,m,l,k;
ll ans;
/*queue<ll> q; stack<ll> s; // Ascending queue priority_queue <int,vector<int>,greater<int> > q; // Descending queue priority_queue <int,vector<int>,less<int> >q;*/
double solve(double w)
{
double w1=w;
for(ll i=1;i<=100;i++)
{
w1=w1-(w1*w1*w1-w)/(3*w1*w1);
}
return w1;
}
int main()
{
ios::sync_with_stdio(false);
double n;
cin>>n;
cout<<fixed<< setprecision(6)<<solve(n)<<endl;
return 0;
}
边栏推荐
- 太不好用了,长文章加图文,今后只写小短文
- Add discount recharge and discount shadow ticket plug-ins to the resource realization applet
- AdaBoost use
- asp.net(c#)的货币格式化
- Oracle advanced (III) detailed explanation of data dictionary
- Applet (global data sharing)
- The combination of deep learning model and wet experiment is expected to be used for metabolic flux analysis
- kubeadm系列-00-overview
- Introduction Guide to stereo vision (3): Zhang calibration method of camera calibration [ultra detailed and worthy of collection]
- Halcon color recognition_ fuses. hdev:classify fuses by color
猜你喜欢

编辑器-vi、vim的使用

ROS learning 4 custom message

Huber Loss

Applet (use of NPM package)

牛顿迭代法(解非线性方程)
![Introduction Guide to stereo vision (4): DLT direct linear transformation of camera calibration [recommended collection]](/img/ed/0483c529db2af5b16b18e43713d1d8.jpg)
Introduction Guide to stereo vision (4): DLT direct linear transformation of camera calibration [recommended collection]
![3D reconstruction open source code summary [keep updated]](/img/ec/984aede7ef9e758abd52fb5ff4e144.jpg)
3D reconstruction open source code summary [keep updated]

Introduction Guide to stereo vision (7): stereo matching

信息與熵,你想知道的都在這裏了
![[code practice] [stereo matching series] Classic ad census: (4) cross domain cost aggregation](/img/d8/7291a5b14160600ba73810e6dd1eb5.jpg)
[code practice] [stereo matching series] Classic ad census: (4) cross domain cost aggregation
随机推荐
Multiple solutions to one problem, asp Net core application startup initialization n schemes [Part 1]
C#【必备技能篇】ConfigurationManager 类的使用(文件App.config的使用)
Multiple linear regression (sklearn method)
Ecmascript6 introduction and environment construction
Applet (use of NPM package)
golang 基础 —— golang 向 mysql 插入的时间数据和本地时间不一致
Ros-10 roslaunch summary
嗨 FUN 一夏,与 StarRocks 一起玩转 SQL Planner!
一题多解,ASP.NET Core应用启动初始化的N种方案[上篇]
Codeforces round 684 (Div. 2) e - green shopping (line segment tree)
Attention is all you need
信息与熵,你想知道的都在这里了
Ministry of transport and Ministry of Education: widely carry out water traffic safety publicity and drowning prevention safety reminders
Configuration and startup of kubedm series-02-kubelet
[technical school] spatial accuracy of binocular stereo vision system: accurate quantitative analysis
Transfer learning and domain adaptation
OpenFeign
Rebuild my 3D world [open source] [serialization-2]
浅谈Label Smoothing技术
fs. Path module