Difference between revisions of "AssertEqualsNumericalPoly"
From ApCoCoAWiki
(New page: <command> <title>AssertEqualsNumericalPoly</title> <short_description>Compares two numerical polynomials</short_description> <syntax> $apcocoa/ts/assert.AssertEqualsNumericalPoly(Result: P...) |
|||
Line 18: | Line 18: | ||
<example> | <example> | ||
F := 0.212*x + 2.103*xy; G := 0.00001*x^2 + 0.214*x + 2.1*xy; | 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 | + | $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; | 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 | + | $apcocoa/ts/assert.AssertEqualsNumericalPoly(F,G,00.1,"Polynomials are numerically not the same."); -- throws an error => test not passed |
</example> | </example> | ||
Revision as of 17:55, 22 June 2010
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