|
| def | ExactIntegrationOfSinus (t, a=None, b=None) |
| |
| def | ExactIntegrationOfSinusWithExponentialKernel (t, ti, alpha=None, beta=None) |
| |
| def | ExactIntegrationOfTail (end_time, end_time_minus_tw, initial_time, ais, tis) |
| |
| def | ApproximateQuadrature (times, f) |
| |
| def | NaiveQuadrature (times, f) |
| |
| def | Alpha (n, j) |
| |
| def | Beta (n, j) |
| |
| def | Gamma (n, j) |
| |
| def | Coefficient (order, n, j) |
| |
| def | Daitche (times, f, order) |
| |
| def | DaitcheTimesAndIntegrands (times, integrands, order) |
| |
| def | Phi (t) |
| |
| def | Hinsberg (m, t_win, times, f, which_set_of_points='hinsberg') |
| |
| def | OmegaTaylorTerms (alpha, bi, pi) |
| |
| def | A (alpha, p, f, t, times, c=1) |
| |
| def | Bombardelli (times, f_to_integrate, order=1) |
| |
| def | SubstituteRichardsons (approx_successive_values, k, order, level=- 1) |
| |
| def | SubstituteEmpiricalRichardsons (approx_successive_values, k, order, level=- 1) |
| |
| def | SubstituteShanks (approx_sequence) |
| |
| def | LogInterpolation (a, b) |
| |
|
| int | end_time = 10 |
| |
| float | t_win = 1.0 |
| |
| int | n_discretizations = 7 |
| |
| int | min_exp = 3 |
| |
| int | k = 2 |
| |
| int | m = 10 |
| |
| int | order_bomb = 1 |
| |
| | f = math.sin |
| |
| list | n_div = [k ** (min_exp + i) for i in range(n_discretizations)] |
| |
| list | n_sizes = [end_time / number for number in n_div] |
| |
| int | n_theor_slopes = 2 |
| |
| | n_samples = int(min(8, n_div[0])) |
| |
| list | exact_values = [0] * n_discretizations |
| |
| list | approx_values_naive = [0] * n_discretizations |
| |
| list | approx_values_1 = [0] * n_discretizations |
| |
| list | approx_values_2 = [0] * n_discretizations |
| |
| list | approx_values_3 = [0] * n_discretizations |
| |
| list | approx_values_bomb = [0] * n_discretizations |
| |
| list | approx_values_hins = [0] * n_discretizations |
| |
| list | approx_values_hins_t_norm = [0] * n_discretizations |
| |
| list | approx_values_hins_abs = [0] * n_discretizations |
| |
| list | errors_naive = [0] * n_discretizations |
| |
| list | errors_1 = [0] * n_discretizations |
| |
| list | errors_2 = [0] * n_discretizations |
| |
| list | errors_3 = [0] * n_discretizations |
| |
| list | errors_bomb = [0] * n_discretizations |
| |
| list | errors_hins = [0] * n_discretizations |
| |
| list | errors_hins_t_norm = [0] * n_discretizations |
| |
| list | errors_hins_abs = [0] * n_discretizations |
| |
| list | errors_naive_rich = [0] * n_discretizations |
| |
| list | errors_1_rich = [0] * n_discretizations |
| |
| list | errors_2_rich = [0] * n_discretizations |
| |
| list | errors_3_rich = [0] * n_discretizations |
| |
| list | errors_bomb_rich = [0] * n_discretizations |
| |
| list | errors_hins_rich = [0] * n_discretizations |
| |
| list | errors_naive_rich_emp = [0] * n_discretizations |
| |
| list | errors_1_rich_emp = [0] * n_discretizations |
| |
| list | errors_2_rich_emp = [0] * n_discretizations |
| |
| list | errors_3_rich_emp = [0] * n_discretizations |
| |
| list | errors_bomb_rich_emp = [0] * n_discretizations |
| |
| list | errors_hins_rich_emp = [0] * n_discretizations |
| |
| list | errors_naive_shank = [0] * n_discretizations |
| |
| list | errors_1_shank = [0] * n_discretizations |
| |
| list | errors_2_shank = [0] * n_discretizations |
| |
| list | errors_3_shank = [0] * n_discretizations |
| |
| list | errors_bomb_shank = [0] * n_discretizations |
| |
| list | errors_hins_shank = [0] * n_discretizations |
| |
| int | j = 0 |
| |
| int | h = end_time / n_divisions |
| |
| list | times = [h * delta for delta in range(n_divisions * i // n_samples)] |
| |
| | exact_value = float(ExactIntegrationOfSinus(times[-1])) |
| |
| def | approx_value_1 = Daitche(times, f, 1) |
| |
| def | approx_value_2 = Daitche(times, f, 2) |
| |
| def | approx_value_3 = Daitche(times, f, 3) |
| |
| def | approx_value_bomb = Bombardelli(times, f, order_bomb) |
| |
| def | approx_value_hins = Hinsberg(m, t_win, times, f) |
| |
| def | approx_value_hins_t_norm = Hinsberg(m, t_win, times, f, 't-norm') |
| |
| def | approx_value_hins_abs = Hinsberg(m, t_win, times, f, 'abs-norm') |
| |
| int | approx_value_naive = 1 |
| |
| | error_naive = abs(approx_value_naive - exact_value) |
| |
| | error_1 = abs(approx_value_1 - exact_value) |
| |
| | error_2 = abs(approx_value_2 - exact_value) |
| |
| | error_3 = abs(approx_value_3 - exact_value) |
| |
| | error_bomb = abs(approx_value_bomb - exact_value) |
| |
| | error_hins = abs(approx_value_hins - exact_value) |
| |
| | error_hins_t_norm = abs(approx_value_hins_t_norm - exact_value) |
| |
| | error_hins_abs = abs(approx_value_hins_abs - exact_value) |
| |
| list | approx_values_naive_rich = [value for value in approx_values_naive] |
| |
| list | approx_values_1_rich = [value for value in approx_values_1] |
| |
| list | approx_values_2_rich = [value for value in approx_values_2] |
| |
| list | approx_values_3_rich = [value for value in approx_values_3] |
| |
| list | approx_values_bomb_rich = [value for value in approx_values_bomb] |
| |
| list | approx_values_hins_rich = [value for value in approx_values_hins] |
| |
| list | approx_values_naive_rich_emp = [value for value in approx_values_naive] |
| |
| list | approx_values_1_rich_emp = [value for value in approx_values_1] |
| |
| list | approx_values_2_rich_emp = [value for value in approx_values_2] |
| |
| list | approx_values_3_rich_emp = [value for value in approx_values_3] |
| |
| list | approx_values_bomb_rich_emp = [value for value in approx_values_bomb] |
| |
| list | approx_values_hins_rich_emp = [value for value in approx_values_hins] |
| |
| list | approx_values_naive_shank = [value for value in approx_values_naive] |
| |
| list | approx_values_1_shank = [value for value in approx_values_1] |
| |
| list | approx_values_2_shank = [value for value in approx_values_2] |
| |
| list | approx_values_3_shank = [value for value in approx_values_3] |
| |
| list | approx_values_bomb_shank = [value for value in approx_values_bomb] |
| |
| list | approx_values_hins_shank = [value for value in approx_values_hins] |
| |
| list | theoretical_slope_naive = [] |
| |
| list | theoretical_slope_1 = [errors_1[- 1] / 0.5 ** (2 * (n_theor_slopes - i) - 0.5) for i in range(n_theor_slopes)] |
| |
| list | theoretical_slope_2 = [errors_2[- 1] / 0.5 ** (3 * (n_theor_slopes - i) - 1.5) for i in range(n_theor_slopes)] |
| |
| list | theoretical_slope_3 = [errors_3[- 1] / 0.5 ** (4 * (n_theor_slopes - i) - 2.5) for i in range(n_theor_slopes)] |
| |
| list | theoretical_slope_bomb = [errors_bomb[- 1] / 0.5 ** (1 * (n_theor_slopes - i) + 0.5) for i in range(n_theor_slopes)] |
| |
| list | theoretical_slope_hins = [errors_hins[- 1] / 0.5 ** (2 * (n_theor_slopes - i) - 0.5) for i in range(n_theor_slopes)] |
| |
| | color |
| |
| | linestyle |
| |
| | linewidth |
| |
| | ms |
| |
| | marker |
| |
| | label |
| |
| list | bomb_sizes = [size / 1 for size in n_sizes] |
| |
| | mew |
| |
| list | annotation_cooors_naive = [LogInterpolation(n_sizes[- 1], n_sizes[- 2]), LogInterpolation(theoretical_slope_naive[- 1], theoretical_slope_naive[- 2])] |
| |
| list | annotation_cooors_1 = [LogInterpolation(n_sizes[- 1], n_sizes[- 2]), LogInterpolation(theoretical_slope_1[- 1], theoretical_slope_1[- 2])] |
| |
| list | annotation_cooors_2 = [LogInterpolation(n_sizes[- 1], n_sizes[- 2]), LogInterpolation(theoretical_slope_2[- 1], theoretical_slope_2[- 2])] |
| |
| | xy |
| |
| | xycoords |
| |
| | xytext |
| |
| | textcoords |
| |
| | fontsize |
| |
| | arrowprops |
| |
| list | annotation_cooors_3 = [LogInterpolation(n_sizes[- 1], n_sizes[- 2]), LogInterpolation(theoretical_slope_3[- 1], theoretical_slope_3[- 2])] |
| |
| list | annotation_cooors_bomb = [LogInterpolation(n_sizes[- 1], n_sizes[- 2]), LogInterpolation(theoretical_slope_bomb[- 1], theoretical_slope_bomb[- 2])] |
| |
| | loc |
| |
| | prop |
| |
| | frameon |
| |
| | format |
| |
| | dpi |
| |