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
I have a dynamics problem where I need to fetch data (e.g. using linear interpolation) within the derivative. Is such a thing possible?
using ReachabilityAnalysis, Interpolations
tspan = (0.0, 10.0)
f(x) = x^2# real f
xs =range(tspan[1], tspan[2], length =20);
data =f.(xs)
Lin_interp =LinearInterpolation(data, XS) # interpolated f@taylorizefunctionf_real(du, u, p, t)
du[1] =f(t)
end@taylorizefunctionf_interp(du, u, p, t)
du[1] =Lin_interp(xs)
end
X0 =Interval(0, 0.1)
prob =@ivp(x'=f_real(x), x(0) ∈ X0, dim=1)
prob_interp =@ivp(x'=f_interp(x), x(0) ∈ X0, dim=1)
sol =solve(prob, tspan = (0.0, 10.0), alg =TMJets21a(abstol =1e-10))
sol_interp =solve(prob_interp, tspan = (0.0, 10.0), alg =TMJets21a(abstol =1e-10))
plot(sol,vars = (0, 1))
plot(sol_interp, vars = (0, 1))
When running solve with the interpolated version, it tries to evaluate the function with a Taylor series.
My initial thoughts on doing this is that we could take the bounding box of the Taylor model, and evaluate the interpolator with it. Perhaps using interval arithmetic, but for the case of linear interpolations I believe we can get the exact bounds, as either the endpoints or the maximum and minimum data value within the range. i.e. something like this:
using IntervalArithmetic: interval
functioninterpolate(Lin_interp, x::Interval)
grid = Lin_interp.itp.knots[1]
data = Lin_interp.itp.coefs
data_in_x = data[grid .∈ x]
x_lo =Lin_interp(x.lo)
x_hi =Lin_interp(x.hi)
points = [data_in_x; x_lo; x_hi]
returninterval(minimum(points), maximum(points))
end
The text was updated successfully, but these errors were encountered:
I have a dynamics problem where I need to fetch data (e.g. using linear interpolation) within the derivative. Is such a thing possible?
When running
solve
with the interpolated version, it tries to evaluate the function with a Taylor series.My initial thoughts on doing this is that we could take the bounding box of the Taylor model, and evaluate the interpolator with it. Perhaps using interval arithmetic, but for the case of linear interpolations I believe we can get the exact bounds, as either the endpoints or the maximum and minimum data value within the range. i.e. something like this:
The text was updated successfully, but these errors were encountered: