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...) |
(Undo revision 12354 by Chruse Arroyo (Talk)) |
||
(2 intermediate revisions by 2 users not shown) | |||
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> | ||
Latest revision as of 10:00, 30 November 2011
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