#include "ibex.h"

using namespace ibex;

int main(){
  // State variables
  Variable y(3);

  // Initialisation of y
  IntervalVector yinit(3);
  yinit[0]= Interval(1.0);
  yinit[1]= 1.0;
  yinit[2]= 3.0;

  // Algebraic variables
  Variable x(2);

  // Initialisation of x
  IntervalVector xinit(2);
  xinit[0]= Interval(0.5);
  xinit[1]= 1.0;

  // Derivative function
  Function ydot = Function(y, x, Return(y[1]+x[0],
					y[0]-y[1]*x[0],
					y[0]*y[2]-x[1]));

  // Explicit constraints
  Function g = Function(y, x, Return(y[0]-x[1], y[1]-2*x[0]));

  // IVP construction (initial time is 0.0)
  ivp_dae_h1 problem = ivp_dae_h1(ydot, g, 0.0, yinit, xinit);

  // Simulation construction and run (final time is 0.5)
  simulation simu = simulation(&problem, 0.5, RADAU3_DAE, 1e-14);
  simu.run_simulation();

  return 0;
}