Difference between revisions of "TestNumPoly"
From ApCoCoAWiki
(New page: <command> <title>TestNumericalNumber</title> <short_description>Compares two numerical polynomials</short_description> <syntax> ApCoCoATest.TestNumericalNumber(f: POLY, e: POLY, Eps: RAT):...) |
m |
||
Line 21: | Line 21: | ||
[TRUE] | [TRUE] | ||
+ | ------------------------------- | ||
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; | ||
ApCoCoATest.TestNumPoly(F,E,0.01); | ApCoCoATest.TestNumPoly(F,E,0.01); |
Revision as of 17:20, 12 October 2009
TestNumericalNumber
Compares two numerical polynomials
Syntax
ApCoCoATest.TestNumericalNumber(f: POLY, e: POLY, Eps: RAT):LIST
Description
This function compares two numerical polynomials e and f. The sum over the absolute values of the coefficients of e-f must be smaller than Eps.
@param Found: The first numerical polynomial
@param Expected: The second numerical polynomial
@param Eps: The allowed difference between the two polynomials
@return A list. First entry is a boolean, its value is TRUE, if the test has been passed. If FALSE, the list contains also the expected and the found polynomial.
Example
F := 0.212 x + 2.103 xy; E := 0.00001 x^2 + 0.214 x + 2.1 xy; ApCoCoATest.TestNumPoly(F,E,0.1); [TRUE] ------------------------------- F := 0.212 x + 2.103 xy; E := 0.00001 x^2 + 0.214 x + 2 xy; ApCoCoATest.TestNumPoly(F,E,0.01); [FALSE, 2103/1000xy + 53/250x, 1/100000x^2 + 2xy + 107/500x] -------------------------------