View Single Post
  #10 (permalink)  
Old 01-03-2008, 11:04 PM
gibsonrocker800's Avatar
gibsonrocker800 gibsonrocker800 is offline
Senior Member
 
Join Date: Nov 2007
Location: New York
Posts: 143
gibsonrocker800 is on a distinguished road
Send a message via AIM to gibsonrocker800
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;
}

}

-------------------------------------------------------------
Reply With Quote