User:Simpsons contributor/Cube root of 1

package newtonsmethodfractal;

/*Applying Newton's method to the polynomial * x^3 - 1 = 0 to find the complex root. Stores * the iteration count and eventual root (attractor) * that the original complex number leads to. */

public class CubeRootOf1 {   int iteration; private ComplexOperations operations = new ComplexOperations; private Complex xSquared = new Complex; private Complex xCubed = new Complex; public Complex function(Complex input) {       //Function: x^3 - 1 xSquared = operations.multiply(input, input); xCubed = operations.multiply(input, xSquared); //Subtract 1 from the real part of xCubed xCubed.realDouble = xCubed.realDouble - 1; return xCubed; }   public Complex derivative(Complex input) {       //Derivative = 3x^2 xSquared = operations.multiply(input, input); //Multiply the real and imaginary parts by three xSquared.realDouble = 3 * xSquared.realDouble; xSquared.imaginaryDouble = 3 * xSquared.imaginaryDouble; return xSquared; }   public int test(Complex input) {       //Returns 866, -866 or 0 Number numberimaginaryTest = 1000 * input.imaginaryDouble; int intimaginaryTest = numberimaginaryTest.intValue; return intimaginaryTest; } }