作业帮 > 综合 > 作业

求解一道牛顿迭代法的题

来源:学生作业帮 编辑:百度作业网作业帮 分类:综合作业 时间:2024/05/16 07:01:38
求解一道牛顿迭代法的题
原题是求解非线性方程 x^5+35x^4-25x^3+10x^2+x+9=0 求X
我用牛顿迭代法解,貌似出现了很多错误~帮忙修正或者直接给个新解题方法~~好的加分!
#include
#include
double func(double x)
{
return x*x*x*x*x+35*x*x*x*x-25*x*x*x+10*x*x+x+9;
}
double func(double x)
{
return 5*x*x*x*x+140*x*x*x-75*x*x+20*x+1;
}
int newton(double *x,double precision,int maxcyc)
{
double x1,x0;
int k;
x0=*x;
for(k=0;k
求解一道牛顿迭代法的题
#include
#include
//原函数
double Func(double x)
{
return x*x*x*x*x+35*x*x*x*x-25*x*x*x+10*x*x+x+9;
}
//导函数
double DerivedFunc(double x)
{
return 5*x*x*x*x+140*x*x*x-75*x*x+20*x+1;
}
//与0的比较
BOOL IsZero(double x)
{
return (x = -0.000001);
}
BOOL newton(double *x,double precision,int maxcyc)
{
double x1,x0;
int k;
x0=*x;
for(k=0;k