用牛顿迭代法求方程在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\n",x1);
    return 0;
}

posted @ 2020-05-13 10:37  采姑娘的小蘑菇a  阅读(1425)  评论(0编辑  收藏  举报
求投食~(点图即可)