org.shiftone.bigcalc.math.function
Class BigPiCalculator

java.lang.Object
  extended byorg.shiftone.bigcalc.core.function.AbstractNoArgumentFunction
      extended byorg.shiftone.bigcalc.math.function.BigPiCalculator
All Implemented Interfaces:
Function, Functor, MathConstants

public class BigPiCalculator
extends AbstractNoArgumentFunction
implements Function, MathConstants

Pi = 16 * arctan(1/5) + 4 * arctan(1/239) arctan(x) = x - x^3/3 + x^5/5 - x^7/7 + x^9/9 - x^11/11 ...

Version:
$Revision: 1.11 $
Author:
$Author: jeffdrost $

Field Summary
 
Fields inherited from interface org.shiftone.bigcalc.math.MathConstants
BD_239, FIVE, FOUR, I_TWO, ONE, TWO, ZERO
 
Constructor Summary
BigPiCalculator()
           
 
Method Summary
 java.lang.Object evaluate(Context context)
           
static java.math.BigDecimal pi(int scale)
          pi/4 = 4*arctan(1/5) - arctan(1/239)
 void print(java.lang.StringBuffer sb, Context context)
           
 
Methods inherited from class org.shiftone.bigcalc.core.function.AbstractNoArgumentFunction
setArguments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.shiftone.bigcalc.Function
setArguments
 

Constructor Detail

BigPiCalculator

public BigPiCalculator()
Method Detail

evaluate

public java.lang.Object evaluate(Context context)
                          throws java.lang.Exception
Specified by:
evaluate in interface Functor
Throws:
java.lang.Exception

pi

public static java.math.BigDecimal pi(int scale)
pi/4 = 4*arctan(1/5) - arctan(1/239)

Parameters:
scale -
Returns:

print

public void print(java.lang.StringBuffer sb,
                  Context context)
           throws java.lang.Exception
Specified by:
print in interface Functor
Throws:
java.lang.Exception