All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ch.obermuhlner.math.big.internal.AtanhCalculator Maven / Gradle / Ivy

There is a newer version: 2.3.2
Show newest version
package ch.obermuhlner.math.big.internal;

import ch.obermuhlner.math.big.BigRational;

import java.math.BigDecimal;
import java.math.MathContext;

/**
 * Calculates sinus hyperbolicus using the Taylor series.
 * 
 * 

See Wikipedia: Taylor series

* *

No argument checking or optimizations are done. * This implementation is not intended to be called directly.

*/ public class AtanhCalculator extends SeriesCalculator { public static final AtanhCalculator INSTANCE = new AtanhCalculator(); private int n = 0; private AtanhCalculator() { super(true); } @Override protected BigRational getCurrentFactor() { return BigRational.valueOf(1, 2 * n + 1); } @Override protected void calculateNextFactor() { n++; } @Override protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { return new PowerTwoNPlusOneIterator(x, mathContext); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy