当前位置:网站首页>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;
}
边栏推荐
- Ros-11 common visualization tools
- golang 基础 —— golang 向 mysql 插入的时间数据和本地时间不一致
- Illustrated network: what is gateway load balancing protocol GLBP?
- [code practice] [stereo matching series] Classic ad census: (4) cross domain cost aggregation
- 什么是防火墙?防火墙基础知识讲解
- js异步错误处理
- Multiple linear regression (sklearn method)
- LLVM之父Chris Lattner:为什么我们要重建AI基础设施软件
- [daiy4] jz32 print binary tree from top to bottom
- OpenFeign
猜你喜欢

Redis implements a high-performance full-text search engine -- redisearch

什么是防火墙?防火墙基础知识讲解

What is a firewall? Explanation of basic knowledge of firewall

Solutions of ordinary differential equations (2) examples

Count of C # LINQ source code analysis
![[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

My experience from technology to product manager

Applet (subcontracting)

fs. Path module

利用请求头开发多端应用
随机推荐
Jenkins pipeline method (function) definition and call
皮尔森相关系数
Count of C # LINQ source code analysis
L'information et l'entropie, tout ce que vous voulez savoir est ici.
ORACLE进阶(三)数据字典详解
Halcon clolor_ pieces. Hedv: classifier_ Color recognition
Multiple linear regression (sklearn method)
Alibaba cloud sends SMS verification code
Install the CPU version of tensorflow+cuda+cudnn (ultra detailed)
Huber Loss
Codeworks round 638 (Div. 2) cute new problem solution
Blue Bridge Cup provincial match simulation question 9 (MST)
Halcon affine transformations to regions
Nodemon installation and use
优先级队列(堆)
生成对抗网络
Redis implements a high-performance full-text search engine -- redisearch
Summary and Reflection on issues related to seq2seq, attention and transformer in hands-on deep learning
Codeforces round 684 (Div. 2) e - green shopping (line segment tree)
It cold knowledge (updating ing~)
