Beispiel #1
0
def input_poly(lang):
    lan = language[lang]

    pgrade = input_int(lan['input_poly'], lang)

    p = [0]*(pgrade+1)
    for i in range(pgrade+1):
        p[i] = input_float("x^" + str(i) + ": ", lang)
    return poly(p)
Beispiel #2
0
def main(lang):
    max_k = 100
    density = 0.01
    lan = language[lang]
    print("\n"*80) #Clear Screen
    print(str_constants(lang))#Display constants
    print('*'*40)
    g_num = -1
    while(g_num == -1):
        print()
        print(lan['g'])
        g_num = input_int(lan['g_num'],lang)
        if g_num == -1:
            print()
            max_k = input_int(lan['max_k'], lang)
            print()
            density = input_float(lan['prompt_density'], lang)
    g = [None]*g_num
    for i in range(g_num):
        g[i] = input_poly(lang)
    print(lan['h'])
    h_num = input_int(lan['h_num'],lang)
    h = [None]*h_num
    for i in range(h_num):
        h[i] = input_poly(lang)

    g_poly = functools.reduce(operator.mul, g, 1)

    h_poly = functools.reduce(operator.mul, h, 1)

    x_final, y_final = get_x_y_from_g_h(g_poly,h_poly, max_k, density)

    plt.plot(x_final,y_final)
    plt.xlabel(lan['real_axis'])
    plt.ylabel(lan['img_axis'])
    plt.title(lan['graph_title'])
    plt.show()