Project

General

Profile

Feature #980

CoeffSize: function to measure the size of coeffs in a poly

Added by John Abbott over 1 year ago. Updated over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
CoCoA-5 function: new
Target version:
Start date:
24 Nov 2016
Due date:
% Done:

20%

Estimated time:
3.00 h
Spent time:

Description

In email Anna proposed a function, tentatively named CoeffSize, to measure the size of the coeffs in a poly (over QQ).

Discuss.

History

#1 Updated by John Abbott over 1 year ago

The definition originally proposed in email was to return a pair of integers being effectively [max(FloorLog10(num(c))) | c in coeffs] and [max(FloorLog10(den(c))) | c in coeffs].

JAA wrote that he is perplexed by this defn, and proposed two alternatives:
  • determine the least common denom of the coeffs, return log of the commondenom and the max of log of numerators (after clearing the denom)
  • return sum of logs of numerators and sum of logs of denominators (roughly the print-size of the poly)

Anna wrote saying that the idea was to estimate the modulus needed so that (fault-tolerant) rational recovery would work. In this case the result should probably be a single integer being max([FloorLog10(num(c)) + FloorLog10(den(c)) | c in coeffs]. Maybe it would be better to find the max of FloorLog10(num(c)*den(c))?

If the rational recovery tries to be clever by keeping track of common-denom-so-far then CoeffSize needs to be a little more sophisticated (keep track itself of the common-denom-so-far, then return max of log(ScaledNum*CommonDen).

#2 Updated by John Abbott over 1 year ago

Anna has put a first prototype in experimental.cpkg5; it follows the original defn. It is deliberately not documented.

JAA thinks that if we find a function useful then it should be made public because it will probably be useful (eventually) to someone else.

Regarding fault-tolerant rational recovery, JAA thinks the most appropriate size measure for a rational is something like 0.3*(3.5+FloorLog2(num(q)*den(q))+FloorSqrt(FloorLog2(num(q)*den(q)))) if the "continued fraction method" is used.
Probably 4+FloorLog10(num(q)*den(q)) gives a fair approximation in most cases.

#3 Updated by Anna Maria Bigatti over 1 year ago

  • % Done changed from 0 to 20
  • Estimated time set to 3.00 h

Maybe the one I wrote could then be called NumDenSize10?
I still think it is useful, for a human, to know that.

Also available in: Atom PDF