unl.cusack.estimator
Class PiEstimatorModel

java.lang.Object
  |
  +--unl.cusack.estimator.EstimatorModel
        |
        +--unl.cusack.estimator.PiEstimatorModel

public class PiEstimatorModel
extends EstimatorModel

A subclass of EstimatorModel that estimates the value of PI by using the formula pi=4-(4/3)+(4/5)-(4/7)+...


Field Summary
 
Fields inherited from class unl.cusack.estimator.EstimatorModel
estimates, estimatorListeners
 
Constructor Summary
PiEstimatorModel()
          The plain-jane constructor.
 
Method Summary
 double computePiEstimate(int n)
          Computes the partial sum to estimate pi.
 void recalculateEstimates()
          From the abstract classs recalculates each of the estimates, based on the formula, and the parameters.
 
Methods inherited from class unl.cusack.estimator.EstimatorModel
addEstimatorListener, dataChanged, getEstimate, getEstimatorInterval, getFirstEstimate, getMaximumEstimate, getMinimumEstimate, getNumberOfEstimates, setEstimateInterval, setFirstEstimate, setNumberOfEstimates, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PiEstimatorModel

public PiEstimatorModel()
The plain-jane constructor.

Method Detail

computePiEstimate

public double computePiEstimate(int n)
Computes the partial sum to estimate pi.

Parameters:
n - the last index of the sum

recalculateEstimates

public void recalculateEstimates()
From the abstract classs recalculates each of the estimates, based on the formula, and the parameters.

Specified by:
recalculateEstimates in class EstimatorModel