3

How to integrate an interval-algorithm-based nonlinear function (for example, d(F(X))/dX= a/(1+cX), where a=[1, 2], c=[2, 3] are interval constants) using the "IntervalArithmetic" package in Julia? Could you please give an example? Or could you please provide a relevant document? F(X) will come out as an interval with bounds, F(X)=[p, q].

  • 2
    What is an "interval algorithms based nonlinear function"? Maybe you could give a simple example of what you want to do? – Adomas Baliuka Jan 02 '23 at 12:37
  • @AdomasBaliuka Here, by interval algorithms-based nonlinear function, I mean an interval extension of a real-valued function. Real valued function, d(f(x))/dx = 0.5/(1+2.5x). Interval extension of this function is, d(F(X))/dX = [1, 2]/(1+[2, 3]X). – Kanishk Sharma Jan 02 '23 at 13:48
  • Can you give an example answer as well, even for a much simpler case. – Dan Getz Jan 03 '23 at 02:04
  • I don't think that IntervalArithmetic works smoothly with DifferentialEquations.jl. You would be better off calculating for (a = 1, c = 3) and (a = 2, c = 2) with DifferentialEquations and then creating an interval variable with those answers. You could also post your question as a feature request to the github site for IntervalArithmetic. – Bill Jan 03 '23 at 19:56

1 Answers1

2

Just numerical integration? As long as the integrating code is written in Julia (otherwise i suspect it will struggle to understand IntervalArithmetic) and there isn't some snag about how it should interpret tolerances, then it should just work, more or less how you might expect it to handle e.g. complex numbers.

using IntervalArithmetic
f(x) = interval(1,2)/(1+interval(2,3)*x)

and combined with e.g.

using QuadGK
quadgk(f, 0, 1)

gives ([0.462098, 1.09862], [0, 0.636515]) (so.. i guess here the interpretation is that the error is in the interval 0 to 0.636515 :))

Just as a sanity check, lets just go with a good old trapezodial rule.

using Trapz

xs = range(0, 1,length=100)
trapz(xs, f.(xs))

again gives us the expected interval [0.462098, 1.09862]

Mikael Öhman
  • 2,294
  • 15
  • 21
  • Thank you so much @Mikael. The provided solution is really helpful, could you please let me know how the solution will change if the differential equation is of the form, dx/dt = a/(1+cx), time = [0, 10] seconds? I am using the "IntervalArithmetic.jl" package in Pluto.jl notebook. If possible could you please also answer how can we get an enclosure of the complete response trajectory of 'x' (a plot containing upper and lower bounds of 'x' on the y-axis, and time on the x-axis)? Where dx/dt = a/(1+cx), and time, t = [0, 10]. Could you please provide a solution to this problem? – Kanishk Sharma Jan 11 '23 at 13:23
  • Just replace 1 with 10 in the integration domain? It's literally just one character away from the examples I wrote. – Mikael Öhman Jan 11 '23 at 21:01