TestNumPoly

From ApCoCoAWiki

TestNumPoly

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]
-------------------------------