You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Evaluating TaylorModel1 over interval doesn't work over the definition interval. #210
I guess I should begin apologizing for the poor documentation of the package, which I think is at the core of the issue.
Let me begin on what you expect it worked, the second part of the code. TaylorModel1(6, interval(x0)) creates a Taylor Model of order 6, whose domain is interval(x0), i.e., interval(0.25, 0.25), around its mid point (which is x0 itself). Then, if you evaluate that Taylor Model (or any function on it, which shares domain and expansion point) on the wider interval a, a is not contained in the centered domain of the Taylor Model (centered_dom = domain - expansion_point), and thus the error; I think the package behaves correctly here. The reason we check against the centered domain, is because the expansion is around x0, so the displayed (independent) variable, below "t", is actually the deviations around x0; sorry for not documenting this (and most of the package).
If you want to create a Taylor Model of order 6, whose domain is a = interval(-0.5, 1.0), expanded around its mid point x0, and then use that Taylor Model to estimate the range of the function $f(x)$, you should do the following:
julia>using TaylorModels
julia> a =-0.5..1.0; x0 =mid(a);
julia> x =TaylorModel1(6, a) # same as `TaylorModel1(2, interval(x0), a)`; t represents deviations from x0
[0.25, 0.25]_com + [1.0, 1.0]_com t + [0.0, 0.0]_com
julia>domain(x), expansion_point(x) # This is to check the domain and the expansion point
([-0.5, 1.0]_com, [0.25, 0.25]_com)
julia>f(x) = x*(x-1.1)*(x+2)*(x+2.2)*(x+2.5)*(x+3)*sin(1.7*x+0.5)
f (generic function with 1 method)
julia> fx =f(x) # get the Taylor Model of f, expanded around `x0` valid for the domain `a` (centered at x0)
[-8.36112, -8.36111]_com_NG + [-47.0612, -47.0611]_com_NG t + [-38.3545, -38.3544]_com_NG t² + [90.4376, 90.4377]_com_NG t³ + [102.183, 102.184]_com_NG t⁴ + [-20.5814, -20.5813]_com_NG t⁵ + [-58.0084, -58.0083]_com_NG t⁶ + [-1.97165, 2.71142]_com_NG
julia>fx(centered_dom(x)) # evaluate fx at the (whole) centered domain, equivalent to fx(a-mid(a)) or fTM(a-x0)
[-67.203, 40.4034]_com_NG
julia>f(a) # Naive interval evaluation
[-215.041, 107.521]_com_NG
I evaluated at the centered domain because we used the mid point of a as expansion point.
Now we do the same, estimate the range, but using 0 as the expansion point, so the variable "t" below actually represents what you expect (center is "0").
julia> y =TaylorModel1(6, interval(0.0), a)
[1.0, 1.0]_com t + [0.0, 0.0]_com
julia> fy =f(y)
[-17.4032, -17.4031]_com_NG t + [-67.709, -67.7089]_com_NG t² + [-8.78208, -8.78207]_com_NG t³ + [82.9944, 82.9945]_com_NG t⁴ + [42.7633, 42.7634]_com_NG t⁵ + [-24.3912, -24.3911]_com_NG t⁶ + [-22.3141, 11.3373]_com_NG
julia>fy(a)
[-116.209, 43.201]_com_NG
julia>fy(centered_dom(y)) # same as above, because centered_dom = domain - expansion_point == domain
[-116.209, 43.201]_com_NG
I hope this explains why the error is thrown, and it was actually ok to be thrown.
I am still confused why the "center point" is an singleton interval and why one would define a taylor model over the point and an interval or just an interval but not via just a point.
I am still confused why the "center point" is an singleton interval and why one would define a taylor model over the point and an interval or just an interval but not via just a point.
I guess you refer to TaylorModel1(6, interval(x0)) above, right? There is an external constructor TaylorModel(ord::Int, dom::Interval) which creates a Taylor model independent variable of a given order (ord), over the domain dom, using the expansion pointmid(dom). That is the method you used in the second code snippet above (#210 (comment)). Since x0 is an exact floating point, interval(x0) is a singleton interval. In your example, you should have used TaylorModel(6, a) or TaylorModel(6, interval(x0), a).
Activity
lbenet commentedon Oct 30, 2026
Thanks for reporting, I'll have a look at this on the weekend
lbenet commentedon Oct 31, 2026
I guess I should begin apologizing for the poor documentation of the package, which I think is at the core of the issue.
Let me begin on what you expect it worked, the second part of the code.
TaylorModel1(6, interval(x0))creates a Taylor Model of order 6, whose domain isinterval(x0), i.e.,interval(0.25, 0.25), around its mid point (which isx0itself). Then, if you evaluate that Taylor Model (or any function on it, which shares domain and expansion point) on the wider intervala,ais not contained in the centered domain of the Taylor Model (centered_dom = domain - expansion_point), and thus the error; I think the package behaves correctly here. The reason we check against the centered domain, is because the expansion is aroundx0, so the displayed (independent) variable, below "t", is actually the deviations aroundx0; sorry for not documenting this (and most of the package).If you want to create a Taylor Model of order 6, whose domain is$f(x)$ , you should do the following:
a = interval(-0.5, 1.0), expanded around its mid pointx0, and then use that Taylor Model to estimate the range of the functionI evaluated at the centered domain because we used the mid point of
aas expansion point.Now we do the same, estimate the range, but using 0 as the expansion point, so the variable "t" below actually represents what you expect (center is "0").
I hope this explains why the error is thrown, and it was actually ok to be thrown.
freemin7 commentedon Nov 4, 2026
I am still confused why the "center point" is an singleton interval and why one would define a taylor model over the point and an interval or just an interval but not via just a point.
lbenet commentedon Nov 4, 2026
I guess you refer to
TaylorModel1(6, interval(x0))above, right? There is an external constructorTaylorModel(ord::Int, dom::Interval)which creates a Taylor model independent variable of a given order (ord), over the domaindom, using the expansion pointmid(dom). That is the method you used in the second code snippet above (#210 (comment)). Sincex0is an exact floating point,interval(x0)is a singleton interval. In your example, you should have usedTaylorModel(6, a)orTaylorModel(6, interval(x0), a).