org.apache.commons.math3.analysis.polynomials
Class PolynomialFunctionTest

java.lang.Object
  extended by org.apache.commons.math3.analysis.polynomials.PolynomialFunctionTest

public final class PolynomialFunctionTest
extends Object

Tests the PolynomialFunction implementation of a UnivariateFunction.

Version:
$Id: PolynomialFunctionTest.java 1244107 2012-02-14 16:17:55Z erans $

Field Summary
protected  double tolerance
          Error tolerance for tests
 
Constructor Summary
PolynomialFunctionTest()
           
 
Method Summary
 void checkPolynomial(PolynomialFunction p, String reference)
           
 void testAddition()
           
 void testConstants()
          tests the value of a constant polynomial.
 void testfirstDerivativeComparison()
          tests the firstDerivative function by comparison This will test the functions f(x) = x^3 - 2x^2 + 6x + 3, g(x) = 3x^2 - 4x + 6 and h(x) = 6x - 4
 void testLinear()
          tests the value of a linear polynomial.
 void testMath341()
          tests the firstDerivative function by comparison This will test the functions f(x) = x^3 - 2x^2 + 6x + 3, g(x) = 3x^2 - 4x + 6 and h(x) = 6x - 4
 void testMultiplication()
           
 void testQuadratic()
          Tests a second order polynomial.
 void testQuintic()
          This will test the quintic function f(x) = x^2(x-5)(x+3)(x-1) = x^5 - 3x^4 -13x^3 + 15x^2
 void testSerial()
           
 void testString()
           
 void testSubtraction()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tolerance

protected double tolerance
Error tolerance for tests

Constructor Detail

PolynomialFunctionTest

public PolynomialFunctionTest()
Method Detail

testConstants

public void testConstants()
tests the value of a constant polynomial.

value of this is 2.5 everywhere.


testLinear

public void testLinear()
tests the value of a linear polynomial.

This will test the function f(x) = 3*x - 1.5

This will have the values f(0) = -1.5, f(-1) = -4.5, f(-2.5) = -9, f(0.5) = 0, f(1.5) = 3 and f(3) = 7.5


testQuadratic

public void testQuadratic()
Tests a second order polynomial.

This will test the function f(x) = 2x^2 - 3x -2 = (2x+1)(x-2)


testQuintic

public void testQuintic()
This will test the quintic function f(x) = x^2(x-5)(x+3)(x-1) = x^5 - 3x^4 -13x^3 + 15x^2


testfirstDerivativeComparison

public void testfirstDerivativeComparison()
tests the firstDerivative function by comparison

This will test the functions f(x) = x^3 - 2x^2 + 6x + 3, g(x) = 3x^2 - 4x + 6 and h(x) = 6x - 4


testString

public void testString()

testAddition

public void testAddition()

testSubtraction

public void testSubtraction()

testMultiplication

public void testMultiplication()

testSerial

public void testSerial()

testMath341

public void testMath341()
tests the firstDerivative function by comparison

This will test the functions f(x) = x^3 - 2x^2 + 6x + 3, g(x) = 3x^2 - 4x + 6 and h(x) = 6x - 4


checkPolynomial

public void checkPolynomial(PolynomialFunction p,
                            String reference)


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.