Tue May 20 22:23:39 2025 polynomial_test(): python version: 3.10.12 numpy version: 1.26.4 Test polynomial(). i4_fall_test(): i4_fall() evaluates the falling factorial Fall(I,N). M N Exact i4_fall(M,N) 5 0 1 1 5 1 5 5 5 2 20 20 5 3 60 60 5 4 120 120 5 5 120 120 5 6 0 0 50 0 1 1 10 1 10 10 4000 1 4000 4000 10 2 90 90 18 3 4896 4896 4 4 24 24 98 3 912576 912576 1 7 0 0 i4vec_concatenate_test(): i4vec_concatenate() concatenates two I4VECs Array 1: 0 91 1 31 2 71 3 51 4 31 Array 2: 0 42 1 22 2 12 Array 3 = Array 1 + Array 2: 0 91 1 31 2 71 3 51 4 31 5 42 6 22 7 12 i4vec_permute_test(): i4vec_permute() reorders an I4VEC according to a given permutation. A[*], before rearrangement: 0 1 1 7 2 10 3 5 4 10 5 0 6 11 7 2 8 4 9 7 10 11 11 0 Permutation vector P[*]: 0 6 1 2 2 5 3 11 4 4 5 1 6 9 7 7 8 8 9 0 10 10 11 3 A[P[*]]: 0 11 1 10 2 0 3 0 4 10 5 7 6 7 7 2 8 4 9 1 10 11 11 5 i4vec_sort_heap_index_a_test(): i4vec_sort_heap_index_a() creates an ascending sort index for an I4VEC. Unsorted array A: 0 8 1 22 2 37 3 19 4 33 5 31 6 3 7 40 8 57 9 29 10 28 11 27 12 56 13 39 14 44 15 13 16 21 17 21 18 2 19 33 Sort vector INDX: 0 18 1 6 2 0 3 15 4 3 5 16 6 17 7 1 8 11 9 10 10 9 11 5 12 19 13 4 14 2 15 13 16 7 17 14 18 12 19 8 I INDX(I) A(INDX(I)) 0 18 2 1 6 3 2 0 8 3 15 13 4 3 19 5 16 21 6 17 21 7 1 22 8 11 27 9 10 28 10 9 29 11 5 31 12 19 33 13 4 33 14 2 37 15 13 39 16 7 40 17 14 44 18 12 56 19 8 57 r8vec_concatenate_test() Python version: 3.10.12 r8vec_concatenate() concatenates two R8VECs Array 1: 0: 91.1 1: 31.2 2: 71.3 3: 51.4 4: 31.5 Array 2: 0: 42.6 1: 22.7 2: 12.8 Array 3 = Array 1 + Array 2: 0: 91.1 1: 31.2 2: 71.3 3: 51.4 4: 31.5 5: 42.6 6: 22.7 7: 12.8 r8vec_permute_test(): Python version: 3.10.12 r8vec_permute() permutes an R8VEC. Original array X[]: 0: 1.1 1: 2.2 2: 3.3 3: 4.4 4: 5.5 Permutation vector P[]: 0 1 1 3 2 4 3 0 4 2 Permuted array X[P[*]]: 0: 2.2 1: 4.4 2: 5.5 3: 1.1 4: 3.3 perm0_uniform_test(): perm0_uniform() randomly selects a permutation of 0, ..., N-1. 5 0 2 3 4 8 6 9 7 1 0 4 2 1 7 8 3 6 9 5 1 2 9 0 6 7 3 5 8 4 0 4 3 6 5 1 9 8 2 7 7 2 0 8 5 6 1 3 4 9 mono_upto_enum_test(): mono_upto_enum() can enumerate the number of monomials in M variables, of total degree between 0 and N. N: 0 1 2 3 4 5 6 7 8 M +--------------------------------------------------------------- 1 | 1 2 3 4 5 6 7 8 9 2 | 1 3 6 10 15 21 28 36 45 3 | 1 4 10 20 35 56 84 120 165 4 | 1 5 15 35 70 126 210 330 495 5 | 1 6 21 56 126 252 462 792 1287 6 | 1 7 28 84 210 462 924 1716 3003 7 | 1 8 36 120 330 792 1716 3432 6435 8 | 1 9 45 165 495 1287 3003 6435 12870 mono_next_grlex_test(): mono_next_grlex() computes the next monomial in M variables in grlex order. Let M = 4 2 0 2 2 2 0 3 1 2 0 4 0 2 1 0 3 2 1 1 2 2 1 2 1 0 0 2 3 0 0 3 2 0 0 4 1 0 0 5 0 0 1 0 4 0 1 1 3 1 0 2 1 1 0 3 0 1 1 0 2 1 1 1 1 1 1 2 0 1 2 0 1 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 2 0 0 1 1 0 0 0 3 0 0 1 2 0 0 2 1 0 0 3 0 0 1 0 2 0 1 1 1 2 3 2 2 2 3 3 1 2 3 4 0 2 4 0 3 2 4 1 2 2 4 2 1 0 2 0 2 0 2 1 1 0 2 2 0 0 3 0 1 0 3 1 0 0 4 0 0 2 3 2 1 2 3 3 0 2 4 0 2 2 4 1 1 2 4 2 0 2 5 0 1 0 1 2 2 0 1 3 1 0 1 4 0 0 2 0 3 0 2 1 2 0 2 2 1 3 0 1 1 3 0 2 0 3 1 0 1 3 1 1 0 3 2 0 0 4 0 0 1 mono_rank_grlex_test(): mono_rank_grlex() returns the rank of a monomial in the sequence of all monomials in M dimensions, in grlex order. Print a monomial sequence with ranks assigned. Let M = 3 N = 4 1 0 0 0 2 0 0 1 3 0 1 0 4 1 0 0 5 0 0 2 6 0 1 1 7 0 2 0 8 1 0 1 9 1 1 0 10 2 0 0 11 0 0 3 12 0 1 2 13 0 2 1 14 0 3 0 15 1 0 2 16 1 1 1 17 1 2 0 18 2 0 1 19 2 1 0 20 3 0 0 21 0 0 4 22 0 1 3 23 0 2 2 24 0 3 1 25 0 4 0 26 1 0 3 27 1 1 2 28 1 2 1 29 1 3 0 30 2 0 2 31 2 1 1 32 2 2 0 33 3 0 1 34 3 1 0 35 4 0 0 Now, given a monomial, retrieve its rank in the sequence: 1 0 0 0 4 1 0 0 2 0 0 1 7 0 2 0 15 1 0 2 24 0 3 1 77 3 2 1 158 5 2 1 mono_total_next_grlex_test(): mono_total_next_grlex() lists the monomials in M variables, of total degree N, in grlex order, one at a time. We start the process with (0,0,...,0,N). The process ends with (N,0,...,0,0) Let M = 3 N = 3 1 0 0 3 2 0 1 2 3 0 2 1 4 0 3 0 5 1 0 2 6 1 1 1 7 1 2 0 8 2 0 1 9 2 1 0 10 3 0 0 mono_unrank_grlex(): mono_unrank_grlex() is given a rank, and returns the corresponding monomial in the sequence of all monomials in M dimensions in grlex order. For reference, print a monomial sequence with ranks. Let M = 3 N = 4 1 0 0 0 2 0 0 1 3 0 1 0 4 1 0 0 5 0 0 2 6 0 1 1 7 0 2 0 8 1 0 1 9 1 1 0 10 2 0 0 11 0 0 3 12 0 1 2 13 0 2 1 14 0 3 0 15 1 0 2 16 1 1 1 17 1 2 0 18 2 0 1 19 2 1 0 20 3 0 0 21 0 0 4 22 0 1 3 23 0 2 2 24 0 3 1 25 0 4 0 26 1 0 3 27 1 1 2 28 1 2 1 29 1 3 0 30 2 0 2 31 2 1 1 32 2 2 0 33 3 0 1 34 3 1 0 35 4 0 0 Now choose random ranks between 1 and 35 9 1 1 0 3 0 1 0 1 0 0 0 3 0 1 0 8 1 0 1 mono_value_test(): mono_value() evaluates a monomial. Let M = 3 N = 6 M(X) = x^(0,0,2) M(1,2,3) = 9 M(-2,4,1) = 1 M(X) = x^(0,1,4) M(1,2,3) = 162 M(-2,4,1) = 4 M(X) = x^(4,0,2) M(1,2,3) = 9 M(-2,4,1) = 16 M(X) = x^(2,2,2) M(1,2,3) = 36 M(-2,4,1) = 64 M(X) = x^(0,1,0) M(1,2,3) = 2 M(-2,4,1) = 4 polynomial_add_test(): polynomial_add() adds two polynomials P1(X): + 7.0 * x^(0,0,0) - 5.0 * x^(0,0,1) + 9.0 * x^(1,0,0) + 11.0 * x^(0,0,2) + 0.0 * x^(0,1,2) - 13.0 * x^(3,0,1). P2(X): + 2.0 * x^(0,0,0) + 3.0 * x^(0,1,0) - 8.0 * x^(1,0,0) + 4.0 * x^(2,0,2) + 9.0 * x^(3,0,1). P(X) = P1(X) + P2(X): + 9.0 * x^(0,0,0) - 5.0 * x^(0,0,1) + 3.0 * x^(0,1,0) + 1.0 * x^(1,0,0) + 11.0 * x^(0,0,2) + 4.0 * x^(2,0,2) - 4.0 * x^(3,0,1). polynomial_axpy_test(): polynomial_axpy() adds a multiple of one polynomial to another. P1(X): + 7.0 * x^(0,0,0) - 5.0 * x^(0,0,1) + 9.0 * x^(1,0,0) + 11.0 * x^(0,0,2) + 0.0 * x^(0,1,2) - 13.0 * x^(3,0,1). P2(X): + 2.0 * x^(0,0,0) + 3.0 * x^(0,1,0) - 8.0 * x^(1,0,0) + 4.0 * x^(2,0,2) + 9.0 * x^(3,0,1). Use the multiplier S = 10 P(X) = S * P1(X) + P2(X): + 72.0 * x^(0,0,0) - 50.0 * x^(0,0,1) + 3.0 * x^(0,1,0) + 82.0 * x^(1,0,0) + 110.0 * x^(0,0,2) + 4.0 * x^(2,0,2) - 121.0 * x^(3,0,1). polynomial_compress_test() polynomial_compress() compresses a polynomial. Uncompressed polynomial = + 7.0 * x^(0,0,0) - 5.0 * x^(0,0,1) + 5.0 * x^(0,0,1) + 9.0 * x^(1,0,0) + 11.0 * x^(0,0,2) + 3.0 * x^(0,0,2) + 6.0 * x^(0,0,2) + 0.0 * x^(0,1,2) - 13.0 * x^(3,0,1) + 1e-20 * x^(4,0,0). Compressed polynomial = + 7.0 * x^(0,0,0) + 9.0 * x^(1,0,0) + 20.0 * x^(0,0,2) - 13.0 * x^(3,0,1). polynomial_dif_test(): polynomial_dif() differentiates a polynomial. P(X): + 2.0 * x^(0,0) + 3.0 * x^(3,0) + 4.0 * x^(1,3) + 5.0 * x^(3,4). d3 P(X) dx1 dx1 dx2 = + 120.0 * x^(1,3). polynomial_mul_test(): polynomial_mul() multiplies two polynomials P1(X): + 2.0 * x^(0,0,0) + 3.0 * x^(0,1,0) + 4.0 * x^(1,0,0) + 5.0 * x^(0,1,1). P2(X): + 6.0 * x^(0,0,1) + 7.0 * x^(0,0,2). P(X) = P1(X) * P2(X): + 12.0 * x^(0,0,1) + 14.0 * x^(0,0,2) + 18.0 * x^(0,1,1) + 24.0 * x^(1,0,1) + 51.0 * x^(0,1,2) + 28.0 * x^(1,0,2) + 35.0 * x^(0,1,3). polynomial_print_test(): polynomial_print() prints a polynomial. P1(X) = + 7.0 * x^(0,0,0) - 5.0 * x^(0,0,1) + 9.0 * x^(1,0,0) + 11.0 * x^(0,0,2) + 0.0 * x^(0,1,2) - 13.0 * x^(3,0,1). polynomial_scale_test(): Python version: 3.10.12 polynomial_scale() scales a polynomial by a multiplier S. Original P(X): + 7.0 * x^(0,0,0) - 5.0 * x^(0,0,1) + 9.0 * x^(1,0,0) + 11.0 * x^(0,0,2) + 0.0 * x^(0,1,2) - 13.0 * x^(3,0,1). Apply scale factor S = -0.5 S * P(X): - 3.5 * x^(0,0,0) + 2.5 * x^(0,0,1) - 4.5 * x^(1,0,0) - 5.5 * x^(0,0,2) + 0.0 * x^(0,1,2) + 6.5 * x^(3,0,1). polynomial_sort_test(): Python version: 3.10.12 polynomial_sort() sorts a polynomial by exponent index. Unsorted polynomial: + 0.0 * x^(0,1,2) + 9.0 * x^(1,0,0) - 5.0 * x^(0,0,1) - 13.0 * x^(3,0,1) + 7.0 * x^(0,0,0) + 11.0 * x^(0,0,2). Sorted polynomial: + 7.0 * x^(0,0,0) - 5.0 * x^(0,0,1) + 9.0 * x^(1,0,0) + 11.0 * x^(0,0,2) + 0.0 * x^(0,1,2) - 13.0 * x^(3,0,1). polynomial_value_test(): Python version: 3.10.12 polynomial_value() evaluates a polynomial. P(X) = + 7.0 * x^(0,0,0) - 5.0 * x^(0,0,1) + 9.0 * x^(1,0,0) + 11.0 * x^(0,0,2) + 0.0 * x^(0,1,2) - 13.0 * x^(3,0,1). P(1.000000,2.000000,3.000000) = 61 P(-2.000000,4.000000,1.000000) = 99 polynomial_test(): Normal end of execution. Tue May 20 22:23:40 2025