Package ch.obermuhlner.math.big.internal
Class SinCalculator
- java.lang.Object
-
- ch.obermuhlner.math.big.internal.SeriesCalculator
-
- ch.obermuhlner.math.big.internal.SinCalculator
-
public class SinCalculator extends SeriesCalculator
Calculates sinus using the Maclaurin series.No argument checking or optimizations are done. This implementation is not intended to be called directly.
-
-
Field Summary
Fields Modifier and Type Field Description private BigRationalfactorial2nPlus1static SinCalculatorINSTANCEprivate intnprivate booleannegative
-
Constructor Summary
Constructors Modifier Constructor Description privateSinCalculator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcalculateNextFactor()Calculates the factor of the next term.protected PowerIteratorcreatePowerIterator(java.math.BigDecimal x, java.math.MathContext mathContext)Creates thePowerIteratorused for this series.protected BigRationalgetCurrentFactor()Returns the factor of the highest term already calculated.-
Methods inherited from class ch.obermuhlner.math.big.internal.SeriesCalculator
calculate, getFactor
-
-
-
-
Field Detail
-
INSTANCE
public static final SinCalculator INSTANCE
-
n
private int n
-
negative
private boolean negative
-
factorial2nPlus1
private BigRational factorial2nPlus1
-
-
Method Detail
-
getCurrentFactor
protected BigRational getCurrentFactor()
Description copied from class:SeriesCalculatorReturns the factor of the highest term already calculated.When called for the first time will return the factor of the first term (index 0).
After this call the method
SeriesCalculator.calculateNextFactor()will be called to prepare for the next term.- Specified by:
getCurrentFactorin classSeriesCalculator- Returns:
- the factor of the highest term
-
calculateNextFactor
protected void calculateNextFactor()
Description copied from class:SeriesCalculatorCalculates the factor of the next term.- Specified by:
calculateNextFactorin classSeriesCalculator
-
createPowerIterator
protected PowerIterator createPowerIterator(java.math.BigDecimal x, java.math.MathContext mathContext)
Description copied from class:SeriesCalculatorCreates thePowerIteratorused for this series.- Specified by:
createPowerIteratorin classSeriesCalculator- Parameters:
x- the value xmathContext- theMathContext- Returns:
- the
PowerIterator
-
-