CrushedPixel

Untitled

Dec 28th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. //TODO: explain this eval method
  2.         public double eval(double at) {
  3.             double val = 0;
  4.             for (double coefficient : coefficients) {
  5.                 val = val * at + coefficient;
  6.             }
  7.             return val;
  8.         }
  9.  
  10.         public double eval1(double at) {
  11.             double val = 0;
  12.             for (int i=0; i<coefficients.length; i++) {
  13.                 val += coefficients[i] * Math.pow(at, i);
  14.             }
  15.             return val;
  16.         }
Advertisement
Add Comment
Please, Sign In to add comment