Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static double[] diffPoly(double[] coeffs, int n) {
- int o_indexcoeffs = 1;
- int o_indexwork = 0;
- int o_count = 0;
- int o_potency = n;
- double [] o_workarray = new double [coeffs.length];
- if (n == 0)
- return coeffs; // original function
- if (n > coeffs.length)
- return coeffs;
- for (;n <= coeffs.length ;++n) { // count back
- o_count += 1;
- while (o_count <= n+1) {
- o_workarray [o_indexwork] = coeffs [o_indexcoeffs + n] * (o_potency); // the range of less than n isn't interested
- ++o_count;
- --o_potency;
- }
- o_indexwork += 1 ;
- o_potency = n; // nötig? oder wird potency nur in der schleife verändert und behält sonst seinen wert
- if (o_indexcoeffs +n != coeffs.length)
- ++o_indexcoeffs;
- ++o_potency ;
- else
- return o_workarray;
- }
- return o_workarray;
- }
Add Comment
Please, Sign In to add comment