Advertisement
Guest User

Untitled

a guest
Sep 21st, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1.  
  2. public class maincl {
  3.     /**
  4.      * @param args
  5.      */
  6.     public static void main(String[] args) {
  7.         // TODO Auto-generated method stub
  8.         double fVal;
  9.         double aN;
  10.         double cntN;
  11.         double qN;
  12.         for (double x=0;x<=2;x+=0.2)
  13.         {
  14.             aN=x;
  15.             cntN=0;
  16.             fVal=0;
  17.             while(Math.abs(aN)>0.000001)
  18.             {
  19.                 fVal+=aN;
  20.                 qN=-x*x*(2*cntN+1)/(cntN+1)*(2*cntN+3);            
  21.                 aN=qN*aN;
  22.                 cntN+=1;
  23.             }
  24.             System.out.println("x="+x+" f="+fVal+" cntN="+cntN+" aN="+aN);
  25.         }
  26.         System.out.print("Whasaaap?");
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement