AssertEqualsNumericalPoly
From ApCoCoAWiki
Revision as of 13:58, 28 November 2011 by Chruse Arroyo (talk | contribs)
AssertEqualsNumericalPoly
Compares two numerical polynomials
Syntax
$apcocoa/ts/assert.AssertEqualsNumericalPoly(Result: POLY, Expected: POLY, Eps: RAT, ErrMsg: STRING)
Description
This function compares two numerical polynomials F:='Result' and G:='Expected'. The sum over the absolute values of the coefficients of F-G must be smaller than epsilon 'Eps'. If the polynomials are numerically not the same it throws an error and prints the error message 'ErrMsg'.
@param Result: The first numerical polynomial
@param Expected: The second numerical polynomial
@param Eps: Epsilon
@param ErrMsg: Error Message
Example
F := 0.212*x + 2.103*xy; G := 0.00001*x^2 + 0.214*x + 2.1*xy; $apcocoa/ts/assert.AssertEqualsNumericalPoly(F,G,0.1,"Polynomials are numerically not the same."); -- throws no error => test passed F := 0.212*x + 2.103*xy; E := 0.00001*x^2 + 0.214*x + 2*xy; $apcocoa/ts/assert.AssertEqualsNumericalPoly(F,G,00.1,"Polynomials are numerically not the same."); -- throws an error => test not passed