org.apache.commons.math.analysis.interpolation
Class NevilleInterpolatorTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.math.analysis.interpolation.NevilleInterpolatorTest
All Implemented Interfaces:
junit.framework.Test

public final class NevilleInterpolatorTest
extends junit.framework.TestCase

Testcase for Neville interpolator.

The error of polynomial interpolation is f(z) - p(z) = f^(n)(zeta) * (z-x[0])(z-x[1])...(z-x[n-1]) / n! where f^(n) is the n-th derivative of the approximated function and zeta is some point in the interval determined by x[] and z.

Since zeta is unknown, f^(n)(zeta) cannot be calculated. But we can bound it and use the absolute value upper bound for estimates. For reference, see Introduction to Numerical Analysis, ISBN 038795452X, chapter 2.

Version:
$Revision: 799857 $ $Date: 2009-08-01 09:07:12 -0400 (Sat, 01 Aug 2009) $

Constructor Summary
NevilleInterpolatorTest()
           
 
Method Summary
protected  double partialerror(double[] x, double z)
          Returns the partial error term (z-x[0])(z-x[1])...(z-x[n-1])/n!
 void testExpm1Function()
          Test of interpolator for the exponential function.
 void testParameters()
          Test of parameters for the interpolator.
 void testSinFunction()
          Test of interpolator for the sine function.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NevilleInterpolatorTest

public NevilleInterpolatorTest()
Method Detail

testSinFunction

public void testSinFunction()
                     throws org.apache.commons.math.MathException
Test of interpolator for the sine function.

|sin^(n)(zeta)| <= 1.0, zeta in [0, 2*PI]

Throws:
org.apache.commons.math.MathException

testExpm1Function

public void testExpm1Function()
                       throws org.apache.commons.math.MathException
Test of interpolator for the exponential function.

|expm1^(n)(zeta)| <= e, zeta in [-1, 1]

Throws:
org.apache.commons.math.MathException

testParameters

public void testParameters()
                    throws Exception
Test of parameters for the interpolator.

Throws:
Exception

partialerror

protected double partialerror(double[] x,
                              double z)
                       throws IllegalArgumentException
Returns the partial error term (z-x[0])(z-x[1])...(z-x[n-1])/n!

Throws:
IllegalArgumentException


Copyright © 2003-2010 Apache Software Foundation. All Rights Reserved.