Guest User

Untitled

a guest
Aug 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public static double[] diffPoly(double[] coeffs, int n) {
  2.  
  3.  
  4. int o_indexcoeffs = 1;
  5. int o_indexwork = 0;
  6. int o_count = 0;
  7. int o_potency = n;
  8.  
  9. double [] o_workarray = new double [coeffs.length];
  10.  
  11.  
  12. if (n == 0)
  13. return coeffs; // original function
  14.  
  15. if (n > coeffs.length)
  16. return coeffs;
  17.  
  18.  
  19.  
  20. for (;n <= coeffs.length ;++n) { // count back
  21.  
  22.  
  23. o_count += 1;
  24.  
  25. while (o_count <= n+1) {
  26. o_workarray [o_indexwork] = coeffs [o_indexcoeffs + n] * (o_potency); // the range of less than n isn't interested
  27. ++o_count;
  28. --o_potency;
  29. }
  30.  
  31. o_indexwork += 1 ;
  32. o_potency = n; // nötig? oder wird potency nur in der schleife verändert und behält sonst seinen wert
  33.  
  34. if (o_indexcoeffs +n != coeffs.length)
  35. ++o_indexcoeffs;
  36. ++o_potency ;
  37.  
  38. else
  39. return o_workarray;
  40.  
  41.  
  42. }
  43. return o_workarray;
  44.  
  45. }
Add Comment
Please, Sign In to add comment