def subtest_1(): '''Some specific test cases.''' x = 2.718281828 #x = 0.01 # calculate for n=1..3 print('Calculations with recurrence formula...') sc3a = sincos.sincos_calc_recur(x, 3) sincos.sincos_print(x, 3, sc3a) print('Calculations with explicit trig...') sc3b = sincos.sincos_calc_trig(x, 3) sincos.sincos_print(x, 3, sc3b) # calculate for n=1..8 print('Recurrence for n=1..8...') sc8 = sincos.sincos_calc_recur(x, 8) sincos.sincos_print(x, 8, sc8) # test case for n=1..8 print('Test case for n=1..8...') sincos_all_subtest(x, 8, verbose=True) # s*s + c*c = 1 test sincos_check_unit(sc8, verbose=True)
def doit(x, n): '''Calculate sin(i*x),cos(i*x) for i=1..n using recurrence formula.''' sc = sincos.sincos_calc_recur(x, n) sincos.sincos_print(x, n, sc) return sc