all-roots-certified
▸ function allRootsCertified
(p
: number[][], lb?
: number, ub?
: number, pE?
: number[], getPExact?
: function): RootInterval[]
Defined in roots/certified/all-roots-certified.ts:185
Finds and returns all certified root intervals (bar underflow / overflow) of the given polynomial (with coefficients given in double-double precision (use allRootsCertifiedSimplified if you only require coefficients in double precision (the usual case))), including their multiplicities (see points below).
returns an empty array for a constant or the zero polynomial
Let
W = m * Number.EPSILON * max(1, 2^⌈log₂r⌉)
, wherer
is a rootm
is the number of roots (the 'multiplicity') within the interval, where multiplicity here includes roots seperated by less than2*Number.EPSILON
and not necessarily only exact multiple roots;
the returned intervals are of max width
W
- use refineK1 to reduce the root interval widths further and thus 'resolving' the roots if required (although the roots are already guaranteed extremely accurate!)the retuned root intervals will contain all roots hence the certified in the function name.
the reported multiplicities will be correct up to a multiple of 2 in cases where more than 1 root is reported in the interval
W
described above (else if a multiplicity of 0 or 1 is reported the result is correct)refineK1 can then be used to resolve them further; note however that root seperation is a function of polynomial height and can be very small (see e.g. Improving Root Separation Bounds, Aaron Herman, Hoon Hong, Elias Tsigaridas
optimized for polynomials of degree 1 to about 30
- this is due to Rolle's Theorem being used and not Descartes' rule of signs
- Descartes' methods are asymptotically faster and thus better suited for higher degree polynomials but for lower degrees Rolle's Theorem seems to be faster
precondition: the coefficient magnitudes and degree of the polynomial must be such that overflow won't occur at evaluation points where roots are searched for, e.g. a 20th degree polynomial with coefficients of magnitude around
Number.MAX_SAFE_INTEGER (= 9007199254740991)
evaluated atx = 1000000
will evaluate to about10^136
(10 the the power of 136) which is way too small for overflow to occur, however when evaluated atx = 10^15
overflow will occur; to prevent this unlikely possibility (roots are typically not that large in applications) limit the boundslb
andub
where roots are to be searched for to the range of interest, i.e. don't set them to infinity for automatic calculation
example
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
p | number[][] | - | a polynomial with coefficients given densely as an array of double-double precision floating point numbers (if only double precision coefficients are required then use allRootsCertifiedSimplified instead) from highest to lowest power, e.g. [[0,5],[0,-3],[0,0]] represents the polynomial 5x^2 - 3x ; if the coefficients are double precision (as opposed to double-double) then instead of passing p pass p.map(c => [0,c]) - this will transform the coefficients to double-double precision |
lb | number | 0 | defaults to 0; lower bound of roots to be returned; Number.NEGATIVE_INFINITY may be given if there is no lower bound |
ub | number | 1 | defaults to 1; upper bound of roots to be returned; Number.POSITIVE_INFINITY may be given if there is no upper bound |
pE | number[] | undefined | defaults to undefined ; an error polynomial that provides a coefficientwise error bound on the input polynomial; all coefficients must be positive; if undefined then the input polynomial will be assumed exact |
getPExact | () => number[][] | undefined | defaults to undefined ; a function returning the exact polynomial (with coefficients given as Shewchuk expansions (see the example below)) - getPExact will only be called if required (and can thus be lazy loaded) when the error bounds are too high during calculation preventing certification of the root intervals; if undefined then the input polynomial will be assumed exact |
Returns: RootInterval[]