1.用牛顿迭代法求该方程在1.5附近的根:2X^3-4X^2+3X-6=0#includestdio.h#includemath.hdoublefunc(doublex)//函数{return2*x*x*x-4*x*x+3*x-6.0;}doublefunc1(doublex)//导函数{return6*x*x-8*x+3;}doubleroot(doublenum){doublex0,x1;x0=num;if(func1(x0)==0.0)//若通过初值,函数返回值为0{printf(迭代过程中导数为0!\n);returnx0;}x1=x0-func(x0)/func1(x0);while((fabs(x1-x0))1e-6){x0=x1;x1=x0-func(x0)/func1(x0);}printf(该方程在1.5附近的根为:%lf。\n,x1);returnx1;}main(){root(1.5);}2.用二分法求该方程的根:2X^3-4X^2+3X-6=0#includestdio.h#includemath.hmain(){doublefunc(doublex);doubleroot(doublea,doubleb);root(-10,10);}doublefunc(doublex)//函数{return2*x*x*x-4*x*x+3*x-6.0;}doubleroot(doublea,doubleb){doublex;x=(a+b)/2;if(func(x)==0.0)//若通过初值,函数返回值x{printf(该方程在-10到10区间内的根为:%lf,\n,x);returnx;}elsewhile(fabs(func(x))1e-6){if(func(x)*func(a)0)a=x;elseb=x;x=(a+b)/2;}printf(该方程在-10到10区间内的根为:%lf。\n,x);returnx;}