import javax.swing.*; // program poweres class Scanner

public class BPIH4E14B
{
     // main method begins execution of Java application
     public static void main( String args[] )
     {            
        // ln(x) = 1+y^2/3+y^4/5+y^6/7+...   y=(x-1)/(x+1)
        String s; 
        double x=Double.parseDouble(JOptionPane.showInputDialog("Enter a real number: ")); // read number
        double power=1;
        double ln=1;
        double y=(x-1)/(x+1);
        int plusminus=-1;
        for(double n=1;n<=10000000;n++)
        {
	    power*=y*y;
        ln+=power /(2.0*n+1.0);     
        }
        ln*=2*y;
        s="ln("+x+") = "+ln;
        JOptionPane.showMessageDialog(null,s,"natural logarithm calculation",JOptionPane.PLAIN_MESSAGE);
     } // end method main
} // end class BPIH4E1
