Interface PowerIterator

All Known Implementing Classes:
PowerNIterator, PowerTwoNIterator, PowerTwoNMinusOneIterator, PowerTwoNPlusOneIterator

public interface PowerIterator
Iterator over the powers of a value x.

This API allows to efficiently calculate the various powers of x in a taylor series by storing intermediate results.

For example xn can be calculated using one multiplication by storing the previously calculated xn-1 and x.

getCurrentPower() will be called first to retrieve the initial value.

For later iterations calculateNextPower() will be called before getCurrentPower().
  • Method Details

    • getCurrentPower

      BigDecimal getCurrentPower()
      Returns the current power.
      Returns:
      the current power.
    • calculateNextPower

      void calculateNextPower()
      Calculates the next power.