Difference between revisions of "AssertEqualsNumericalPoly"

From ApCoCoAWiki
(Undo revision 12354 by Chruse Arroyo (Talk))
Line 28: Line 28:
[http://writing-help.org/ essay writing help]

Latest revision as of 10:00, 30 November 2011


Compares two numerical polynomials


$apcocoa/ts/assert.AssertEqualsNumericalPoly(Result: POLY, Expected: POLY, Eps: RAT, ErrMsg: STRING)


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


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