1. import java.math.*;  
  2. public class T5_12 {  
  3.  
  4.     /**  
  5.      * @param args  
  6.      */ 
  7.     public static void main(String[] args) {  
  8.         // TODO Auto-generated method stub  
  9.         /*  
  10.          * 用牛顿迭代法求方程2X*X*X-4X*X+3*X-6=0在X=1.5  
  11.          * 附近的根!  
  12.          *   
  13.          */ 
  14.         double x=1.5,x0,f,f1;  
  15.         do{  
  16.             x0=x;  
  17.             f=2*x0*x0*x0-4*x0*x0+3*x0-6;  
  18.             f1=6*x0*x0-4*x0+3;  
  19.             x=x0-f/f1;  
  20.               
  21.         }while(Math.abs(x-x0)>=1e-16);  
  22.         System.out.println(x0);  
  23.     }  
  24.       
  25.  
  26. }