JuliaIntervals / TaylorModels.jl

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

Shortcut constructor for independent variable #21

Closed mforets closed 5 years ago

mforets commented 5 years ago
julia> using TaylorModels
[ Info: Recompiling stale cache file /Users/forets/.julia/compiled/v1.1/TaylorModels/yPZW1.ji for TaylorModels [a2574a24-d24b-5d8e-9d8b-7eb85f89fcf9]

julia> TaylorModel1(2, Interval(0.5, 0.5), Interval(0.0, 1.0))
 [0.5, 0.5] + [1, 1] t + [0, 0]

julia> TaylorModel1(2, 0.5, Interval(0.0, 1.0))
ERROR: MethodError: no method matching TaylorModel1(::Taylor1{Interval{Float64}}, ::Interval{Float64}, ::Float64, ::Interval{Float64})
Closest candidates are:
  TaylorModel1(::Taylor1{T}, ::Interval{S}, ::Interval{S}, ::Interval{S}) where {T, S} at /Users/forets/.julia/dev/TaylorModels/src/constructors.jl:33
  TaylorModel1(::Integer, ::Any, ::Interval{T}) where T at /Users/forets/.julia/dev/TaylorModels/src/constructors.jl:36
  TaylorModel1(::Interval{T}, ::Integer, ::Interval{T}, ::Interval{T}) where T at /Users/forets/.julia/dev/TaylorModels/src/constructors.jl:41
  ...
Stacktrace:
 [1] TaylorModel1(::Int64, ::Float64, ::Interval{Float64}) at /Users/forets/.julia/dev/TaylorModels/src/constructors.jl:36
 [2] top-level scope at none:0

Changing the penultimate argument in this line, x0, to interval(x0) one can use the short-cut constructor TaylorModel1(2, 0.5, Interval(0.0, 1.0)).