Ask Your Question

Revision history [back]

polynomial and interval arithmetic

Hi,

I would like to evaluate a polynomial on a real interval (an element of RIF). My problem is the following. I take the polynomial x(1-x) which is increasing on (0,1/2). Hence, if I have an interval (l,u) in (0,1/2) and I apply this polynomial, I would like to get an answer close to (l(1-l), u(1-u)) up to rounding error. But what I get is (l(1-u), u(1-l)) which is twice bigger! The following code illustrates the behavior:

sage: l = 3/17
sage: u  = 5/17
sage: x0 = RIF((l,u))
sage: print x0.absolute_diameter()
0.117647058823529
sage: print (x0 * (1-x0)).absolute_diameter()
0.117647058823529
sage: P = PolynomialRing(RIF, 'x')('x - x^2')
sage: P(x0).absolute_diameter()
0.117647058823529

And we can check that this diameter is (l(1-u), u(1-l)):

sage: x1_l = l * (1-u)
sage: x1_u = u * (1-l)
sage: print (x1_u - x1_l).n()
0.117647058823529

which is much bigger than (l(1-l), u(1-u)):

sage: x2_l = l * (1-l)
sage: x2_u = u * (1-u)
sage: print (x2_u - x2_l).n()
0.0622837370242214

Is there a cleaner way to evaluate a polynomial on an element of RIF ?

Vincent