#include #include "integralii.h" void example1(){ ibex::Variable x(1); ibex::Function f(x, x*ibex::cos(x)); ibex::Interval inf_inter(0, 5); ibex::Interval sup_inter(7, 15); IntegralII integ_inter(inf_inter, sup_inter, &f); cout << "Result: " << endl; cout << integ_inter << endl; ibex::Function g(x, x*ibex::sin(x) + ibex::cos(x)); cout << "Calcul avec la solution analytique : " << g << endl; ibex::IntervalVector x_vec(1), y_vec(1); x_vec[0] = integ_inter.get_solution().first.get_inf_endpoint(); y_vec[0] = integ_inter.get_solution().first.get_sup_endpoint(); cout << "\tmin : (" << x_vec << ", " << y_vec << ") : " << g.eval_vector(y_vec) - g.eval_vector(x_vec) << endl; x_vec[0] = integ_inter.get_solution().second.get_inf_endpoint(); y_vec[0] = integ_inter.get_solution().second.get_sup_endpoint(); cout << "\tmax : (" << x_vec << ", " << y_vec << ") : " << g.eval_vector(y_vec) - g.eval_vector(x_vec) << endl; } void example2(){ ibex::Variable x(1); ibex::Function f(x, x*ibex::sin(x)); ibex::Interval inf_inter(0, 5); ibex::Interval sup_inter(7, 15); IntegralII integ_inter(inf_inter, sup_inter, &f); cout << "Result: " << endl; cout << integ_inter << endl; ibex::Function g(x, -x*ibex::cos(x) + ibex::sin(x)); cout << "Calcul avec la solution analytique : " << g << endl; ibex::IntervalVector x_vec(1), y_vec(1); x_vec[0] = integ_inter.get_solution().first.get_inf_endpoint(); y_vec[0] = integ_inter.get_solution().first.get_sup_endpoint(); cout << "\tmin : (" << x_vec << ", " << y_vec << ") : " << g.eval_vector(y_vec) - g.eval_vector(x_vec) << endl; x_vec[0] = integ_inter.get_solution().second.get_inf_endpoint(); y_vec[0] = integ_inter.get_solution().second.get_sup_endpoint(); cout << "\tmax : (" << x_vec << ", " << y_vec << ") : " << g.eval_vector(y_vec) - g.eval_vector(x_vec) << endl; } int main(){ cout << setprecision(15); example2(); return EXIT_SUCCESS; }