- double a = 1.0;
- double b = 10.0;
- double x ;
- double max_deviation = 0.0;
-
- if (method == LAGRANGE_VEGAS)
- lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp, func_vegas_fpi);
- else if (method == LAGRANGE_RENO)
- lmm_set_default_protocol_function(func_reno_f, func_reno_fpi, func_reno_fpi);
-
- Sys = lmm_system_new(1);
- L1 = lmm_constraint_new(Sys, static_cast<void *>(const_cast<char*>("L1")), a);
- L2 = lmm_constraint_new(Sys, static_cast<void *>(const_cast<char*>("L2")), b);
- L3 = lmm_constraint_new(Sys, static_cast<void *>(const_cast<char*>("L3")), a);
-
- R_1_2_3 = lmm_variable_new(Sys, static_cast<void *>(const_cast<char*>( "R 1->2->3")), 1.0, -1.0, 3);
- R_1 = lmm_variable_new(Sys, static_cast<void *>(const_cast<char*>( "R 1")), 1.0, -1.0, 1);
- R_2 = lmm_variable_new(Sys, static_cast<void *>(const_cast<char*>( "R 2")), 1.0, -1.0, 1);
- R_3 = lmm_variable_new(Sys, static_cast<void *>(const_cast<char*>( "R 3")), 1.0, -1.0, 1);
-
- lmm_update_variable_weight(Sys, R_1_2_3, 1.0);
- lmm_update_variable_weight(Sys, R_1, 1.0);
- lmm_update_variable_weight(Sys, R_2, 1.0);
- lmm_update_variable_weight(Sys, R_3, 1.0);
-
- lmm_expand(Sys, L1, R_1_2_3, 1.0);
- lmm_expand(Sys, L2, R_1_2_3, 1.0);
- lmm_expand(Sys, L3, R_1_2_3, 1.0);
-
- lmm_expand(Sys, L1, R_1, 1.0);
- lmm_expand(Sys, L2, R_2, 1.0);
- lmm_expand(Sys, L3, R_3, 1.0);
-
- if (method == MAXMIN) {
- lmm_solve(Sys);
- } else {
- if (method == LAGRANGE_VEGAS) {
- x = 3 * a / 4 - 3 * b / 8 + sqrt(9 * b * b + 4 * a * a - 4 * a * b) / 8;
- /* Computed with mupad and D_f=1.0 */
- if (x > a) {
- x = a;
- }
- if (x < 0) {
- x = 0;
- }
- } else if (method == LAGRANGE_RENO) {
- a_test_1 = a;
- b_test_1 = b;
- x = dichotomy(diff_lagrange_test_1, 0, a, 1e-13);
-
- if (x < 0)
- x = 0;
- if (x > a)
- x = a;
- } else {
- xbt_die( "Invalid method");
- }