JuliaIntervals / TaylorModels.jl

Rigorous function approximation using Taylor models in Julia
Other
63 stars 14 forks source link

Don't Understand How to Use TaylorModelN #62

Closed chelseas closed 3 years ago

chelseas commented 4 years ago

I don't understand how to use TaylorModelN. The documentation is insufficient. Specifying the order, the approximation point, and the interval over which it should be valid makes sense, but what else should I need to specify? And why does it seem like I can't evaluate an ND Taylor model over more than 1D?

lbenet commented 4 years ago

Thanks for reporting, and sorry for the insufficient documentation; lack of time on our side.

The following example is adapted from the tests:

julia> using TaylorModels

julia> const _order = 2  # this will be maximum order of the expansions
2

julia> const _order_max = 2*(_order+1)  # internally, the actual order needs to be larger
6

julia> set_variables(Interval{Float64}, [:x, :y], order=_order_max)
2-element Array{TaylorN{Interval{Float64}},1}:
  [1, 1] x + 𝒪(‖x‖⁷)
  [1, 1] y + 𝒪(‖x‖⁷)

julia> xT = TaylorN(Interval{Float64}, 1, order=_order)  # "shortcuts" for the independent vars
 [1, 1] x + 𝒪(‖x‖³)

julia> yT = TaylorN(Interval{Float64}, 2, order=_order)  # "shortcuts" for the independent vars
 [1, 1] y + 𝒪(‖x‖³)

julia> xm = TaylorModelN(xT, 0..0, b0, ib0)  # TaylorModelN for `x`
 [1, 1] x + [0, 0]

julia> ym = TaylorModelN(yT, 0..0, b0, ib0)  # TaylorModelN for `y`
 [1, 1] y + [0, 0]

julia> xm * ym
 [1, 1] x y + [0, 0]

julia> xm * ym^2
 [0, 0] + [-0.125, 0.125]

I hope this makes things a bit clearer.

lbenet commented 3 years ago

Closing....