/** * Computes the values for each function in the sequence iterative starting at the end and working its way * towards the beginning.. */ protected void computeFunctions( double value ) { f[sequenceLength-1] = sequence[sequenceLength-1].c[0]; if( Double.isInfinite(value)) { f[sequenceLength-2] = multiplyInfinity(sequence[sequenceLength-2].evaluate(value),f[sequenceLength-1]); for( int i = sequenceLength-3; i > 0; i-- ) { // no need to consider the remainder since this will have a higher degree f[i] = multiplyInfinity(sequence[i].evaluate(value),f[i+1]); } } else { f[sequenceLength-2] = sequence[sequenceLength-2].evaluate(value)*f[sequenceLength-1]; for( int i = sequenceLength-3; i > 0; i-- ) { f[i] = sequence[i].evaluate(value)*f[i+1] - f[i+2]; } } f[0] = sequence[0].evaluate(value); }
/** * Computes the values for each function in the sequence iterative starting at the end and working its way * towards the beginning.. */ protected void computeFunctions( double value ) { f[sequenceLength-1] = sequence[sequenceLength-1].c[0]; if( Double.isInfinite(value)) { f[sequenceLength-2] = multiplyInfinity(sequence[sequenceLength-2].evaluate(value),f[sequenceLength-1]); for( int i = sequenceLength-3; i > 0; i-- ) { // no need to consider the remainder since this will have a higher degree f[i] = multiplyInfinity(sequence[i].evaluate(value),f[i+1]); } } else { f[sequenceLength-2] = sequence[sequenceLength-2].evaluate(value)*f[sequenceLength-1]; for( int i = sequenceLength-3; i > 0; i-- ) { f[i] = sequence[i].evaluate(value)*f[i+1] - f[i+2]; } } f[0] = sequence[0].evaluate(value); }