用牛顿迭代法求方程在1.5附近的根(2x3-4x2+3x-6=0)   例:方程求根牛顿迭代法 求方程 f(x)=x3+x2-3x-3=0在1.5附近的根  

#include <stdio.h>
#include <math.h>
int main()
{
    double x0,x1,fx,fx2;
    x0=1.5;
    while(fabs(x1-x0)>=1e-5)
    {
        x0=x1;
        fx=(2*x0*(x0-2)+3)*x0-6;
        fx2=2*x0*(3*x0-4)+3;
        x1=x0-fx/fx2;
        
    }
    printf("%5.2f ",x1);
    return 0;
}

原文地址:https://www.cnblogs.com/LiQingXin/p/12880923.html