Skip to main content

Y0_COEFFS_TAYLOR

Static Y0_COEFFS_TAYLOR 

Source
pub(crate) static Y0_COEFFS_TAYLOR: [[(u64, u64); 28]; 47]
Expand description

Generated Y0 Taylor expansion at zero and extremums.

Generated by SageMath:

mp.prec = 115
terms = 28
print(f"pub(crate) static Y0_COEFFS_TAYLOR: [[(u64, u64); {terms}]; {len(y0_zeros)}] = [")

def get_constant_term(poly, y):
    for term in poly.operands():
        if term.is_constant():
            return term

def print_taylor_coeffs(poly, n):
    print("[")
    for i in range(0, n):
        coeff = poly[i]
        print_double_double("", RealField(300)(coeff))
        # print(f"{double_to_hex(coeff)},")
    print("],")

prev_zero = 0

for i in range(0, len(y0_zeros)):
    k_range = y0_zeros[i]
    range_diff = k_range - prev_zero

    x0 = mp.mpf(k_range)
    from mpmath import mp, bessely, taylor, chebyfit
    poly = taylor(lambda val: bessely(0, val), x0, terms)
    print_taylor_coeffs(poly, terms)
    prev_zero = y0_zeros[i]

print("];")