|
Ok, my SyntheticDivision constructor calls for an array of doubles, the root you want to perform on, and the number of numbers (although this is kinda useless).
Here, its a very short simple class, so here's the code.
------------------------------------------------------
public class SyntheticDivision {
private double[] numbers;
private double root;
private double mid;
private double length;
public SyntheticDivision(double[] nums, double rt, double lth)
{
length = lth;
root = rt;
numbers = nums;
mid = 0;
}
public double findCoefficients(int in)
{
int index = in;
double coef = numbers[index] + mid;
mid = coef * root;
return coef;
}
}
-------------------------------------------------------------
|