Exemple #1
0
def compare(hbar=1, k0=1, m=1, r0=1, V0=-1, deg=40, c=10, maxl=10):
    an.setparams(hbar, k0, m)
    sc.setparams(hbar, k0, m)
    sc.setquadparams(deg, c)
    print(len(sc.KK))
    b = an.box(r0, V0)
    V = b.V

    f = sc.amplitude_f(V, maxl, isbox=False, r0=0)
    fan = b.amplitude_f(maxl)

    theta = np.linspace(0, np.pi, 10000)
    plt.plot(theta, sc.modsq(f(theta)), theta, sc.modsq(fan(theta)))
    print('sc: {}'.format(sc.stot(f) - np.pi * 4 / k0 * np.imag(f(0))))
    print('an: {}'.format(sc.stot(fan) - np.pi * 4 / k0 * np.imag(fan(0))))
    print('----fl----')
    for l in range(maxl + 1):
        print('l={}'.format(l))
        print('sc: {}'.format(sc.tmp_fl[l]))
        print('an: {}'.format(b.f[l]))
        print()
    plt.xlabel(
        'hbar={}, k0={}, m={}, r0={}, V0={}, maxl={}, deg_legendre={}'.format(
            hbar, k0, m, r0, V0, maxl, deg))
    plt.show()
Exemple #2
0
def degdeg():
    r = np.linspace(0, 10, 10000)
    th = np.linspace(0, np.pi, 10000)
    V = col.shell(2, 1, 5)
    plt.plot(r, V(r))
    plt.show()

    g = an.general(1, 1, 1, V, 10)
    fg = g.amplitude_f(10)
    sigg = sc.modsq(fg(th))
    #b = an.box(1, -1)
    #fan = b.amplitude_f(10)

    plt.plot(th, sigg, label='pwa')
    #plt.plot(th, sc.modsq(fan(th)), label='pwa2')

    for deg1 in [20, 30, 40, 60, 80, 100]:
        sc.setquadparams(deg=deg1)
        f = sc.amplitude_f(V, 10)
        sig = sc.modsq(f(th))
        err = utils.error(th, sig, sigg)
        print('deg: {}, error: {}'.format(deg1, err))
        plt.plot(th, sig, label=str(deg1))

    plt.legend()
    plt.xlabel('theta')
    plt.ylabel('differential cross section')
    plt.show()
Exemple #3
0
def kkk():
    r = np.linspace(0, 10, 10000)
    th = np.linspace(0, np.pi, 10000)
    V = col.box(-1, 5)
    plt.plot(r, V(r))
    plt.show()

    K_SAMPLE = [0.01, 0.1, 0.5, 1, 10, 20, 50, 100]

    for k0 in K_SAMPLE:
        g = an.general(1, k0, 1, V, 5)
        fg = g.amplitude_f(10)

        an.k0 = k0
        b = an.box(5, -1)
        fan = b.amplitude_f(10)

        sc.setquadparams(deg=40)
        sc.setparams(k01=k0)
        f = sc.amplitude_f(V, 10, isbox=True, r0=5)

        q = utils.maxerror(th, fg, f)
        #print('maxereror: {}'.format(q))
        plt.plot(th, fg(th), th, f(th), th, fan(th))
        plt.xlabel(sc.summary())
        plt.show()
Exemple #4
0
def a2():
    sc.setquadrature(quad='leg')
    f = lambda r: np.exp(-r**2)
    I = np.sqrt(np.pi) / 2
    S = sum(sc.W * f(sc.K))
    print(S)
    print((S - I) / I)

    sc.setquadrature(quad='lag')
    S = sum(sc.W * f(sc.K))
    print((S - I) / I)

    sc.setquadrature(quad='mixed')
    sc.setquadparams(c=2, r0=0.2)
    S = sum(sc.W * f(sc.K))
    print((S - I) / I)
Exemple #5
0
def maxlmaxl():
    r = np.linspace(0, 10, 10000)
    th = np.linspace(0, np.pi, 10000)
    V = col.ring(2, 1, 5)
    plt.plot(r, V(r))
    plt.show()

    g = an.general(1, 1, 1, V, 10)
    fg = g.amplitude_f(10)
    plt.plot(th, fg(th), label='pwa')
    sc.setquadparams(deg=40)
    for maxl1 in [5, 10, 15, 20, 40, 60]:
        f = sc.amplitude_f(V, maxl1)
        plt.plot(th, f(th), label=str(maxl1))
    plt.legend()
    plt.xlabel('V=ring(2, 1, 5), k=1, deg=40')
    plt.show()
Exemple #6
0
def a1():
    r = np.linspace(0, 10, 10000)
    th = np.linspace(0, np.pi, 10000)

    V = col.box(-1, 5)
    plt.plot(r, V(r))
    plt.show()

    g = an.general(1, 50, 1, V, 5)
    fg = g.amplitude_f(10)

    an.k0 = 50
    b = an.box(5, -1)
    fan = b.amplitude_f(10)

    sc.setquadparams(deg=80)
    sc.setparams(k01=50)
    f = sc.amplitude_f(V, 10)

    plt.plot(th, fg(th), th, f(th), th, fan(th))
    plt.xlabel(sc.summary())
    plt.show()
Exemple #7
0
def sc_l_deg(hbar=1,
             k0=1,
             m=1,
             V=V_sample,
             degs=[30, 40, 50, 60, 70],
             c=10,
             maxl=10):
    an.setparams(hbar, k0, m)
    sc.setparams(hbar, k0, m)
    theta = np.linspace(0, np.pi, 10000)

    b = an.box(5, -1)

    for deg in degs:
        sc.setquadparams(deg, c)
        f = sc.amplitude_f(V, maxl, isbox=True, r0=5)
        plt.plot(theta, sc.modsq(f(theta)), label=str(deg))

    fan = b.amplitude_f(maxl)
    plt.plot(theta, sc.modsq(fan(theta)), label='partial wave')
    plt.legend()
    plt.xlabel('hbar={}, k0={}, m={}, V={}, maxl={}, degs={}'.format(
        hbar, k0, m, 'box(5, -1)', maxl, degs))
    plt.show()