Пример #1
0
# display the original series.
print(formatter.decorate(formatter.COLORS['white'], "Input vector"))
print(formatter.decorate(formatter.COLORS['red'], str(test_values)))


# display the polynomial equation that this series satisfies
print()
print(formatter.decorate(formatter.COLORS['white'], "Polynomial equation satisfying the number series"))
print(formatter.decorate(formatter.COLORS['yellow'], str(result)))


# compute the next logical point along the series.
print()
print(formatter.decorate(formatter.COLORS['white'], "Next logical point along series"))
print(formatter.decorate(formatter.COLORS['yellow'], Polynomial.if_int_get_int(result.solve(num_nums + 1))))


# compute the 'triangle of differences'
print()
print(formatter.decorate(formatter.COLORS['white'], "Triangle of Differences"))
working_list = test_values
while len(working_list) > 1:
    print(formatter.decorate(formatter.COLORS['green'], str(working_list)))
    new_list = []
    for i in range(0, len(working_list) - 1):
        new_list.append(working_list[i + 1] - working_list[i])
    working_list = new_list
print(formatter.decorate(formatter.COLORS['green'], str(working_list)))

print()