fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. double[] list= {0.2, 0.4, 0.6, 0.8, 1.0};
  13.  
  14. for(double a: list){
  15. double MacLurin= a*(1-Math.pow(a,2)*((1.0/3.0)+ (Math.pow(a,2)/5.0)));
  16. double pade = (a*(1.0+ (4.0 * Math.pow(a,2)/15.0)))/(1.0+(3.0* Math.pow(a,2)/5.0));
  17. System.out.printf("MacLaurin is %.5f and Pade is %.5f \n", MacLurin, pade);
  18. }
  19.  
  20. }
  21. }
Success #stdin #stdout 0.08s 34168KB
stdin
Standard input is empty
stdout
MacLaurin is 0.19727    and Pade is 0.19740 
MacLaurin is 0.37662    and Pade is 0.38054 
MacLaurin is 0.51245    and Pade is 0.54079 
MacLaurin is 0.56380    and Pade is 0.67669 
MacLaurin is 0.46667    and Pade is 0.79167