예제 #1
0
 def price_element_real(self,nu,tau,q_value):
     p1 = m.exp(-(nu**2-q_value**2)*tau/2)
     p2 = (q_value*m.gamma((nu+q_value)/2))/(4*self.eta_q(nu=nu,eigenval=q_value,b=self.b)*m.gamma(1+q_value))
     const = (2*self.k)**((nu+3)/2)*m.exp(-1/(4*self.k))
     w1 = m.whitw(-(nu+3)/2,q_value/2,1/(2*self.k))
     m1 = m.whitm((1-nu)/2,q_value/2,1/(2*self.b))
     return p1 * p2 * const * w1 * m1
예제 #2
0
 def price_element_imag(self,nu,tau,p_value):
     p1 = m.exp(-(nu**2+p_value**2)*tau/2)
     p2 = (p_value*m.gamma(complex(nu/2,p_value/2)))/(4*self.xi_p(nu=nu,eigenval=p_value,b=self.b)*m.gamma(complex(1,p_value)))
     const = (2*self.k)**((nu+3)/2)*m.exp(-1/(4*self.k))
     w1 = m.whitw(-(nu+3)/2,complex(0,p_value/2),1/(2*self.k))
     m1 = m.whitm((1-nu)/2,complex(0,p_value/2),1/(2*self.b))
     return p1 * p2 * const * w1 * m1
예제 #3
0
    def __init__(self, system_params, wf_params, potential_params, r):
        system = NuclearSystem(wf_params, system_params, potential_params)
        system.calculate_energy()
        self.bound_energy = system.energies[0]

        wf = WaveFunction(wf_params)
        radial_wavefunctions = r * np.matmul(system.C.transpose(), wf.phi(r))
        self.bound_wavefunction = np.abs(radial_wavefunctions[0, :])

        k = np.sqrt(-2 * self.bound_energy * system.mass / system.const1)
        eta = system.mass * system.z1 * system.z2 * system.const2 / k / system.const1

        self.whitw_ = np.array(
            [whitw(-eta, wf.l + 0.5, 2 * k * r_i) for r_i in r], dtype=float)
예제 #4
0
def psi(index, variable, b, a, beta):

    if b == 0:

        if beta < 0:
            return math.pow(variable, 0.5) * besseli(
                v(beta), sqrt(2 * index * q(a, beta, variable)))
        else:
            return math.pow(variable, 0.5) * besselk(
                v(beta), sqrt(2 * index * q(a, beta, variable)))
    else:

        if beta < 0:
            return math.pow(variable, beta + 0.5) * math.exp(
                0.5 * eps(b, beta) * h(b, a, beta, variable)) * whitm(
                    k(b, beta, index), m(beta), h(b, a, beta, variable))

        else:
            return math.pow(variable, beta + 0.5) * math.exp(
                0.5 * eps(b, beta) * h(b, a, beta, variable)) * whitw(
                    k(b, beta, index), m(beta), h(b, a, beta, variable))
예제 #5
0
파일: asian.py 프로젝트: daifengqi/PyFENG
 def xi_p(self, eigenval):
     nu = self.nu()
     func = lambda x: m.whitw((1 - nu) / 2, complex(0, x / 2), 1 / (2 * self.b))
     return complex(derivative(func, eigenval, dx=1e-12))
예제 #6
0
파일: asian.py 프로젝트: daifengqi/PyFENG
    def eta_q(self, eigenval):
        nu = self.nu()

        f = lambda x: m.whitw((1 - nu) / 2, x / 2, 1 / (2 * self.b))
        return complex(-derivative(f, eigenval, dx=1e-12))
예제 #7
0
 def xi_p(self,nu,eigenval,b):
     f = lambda x: m.whitw((1-nu)/2,complex(0,x/2),1/(2*b))
     return complex(derivative(f,eigenval,dx=1e-12))
예제 #8
0
 def eta_q(self,nu,eigenval,b):
     f = lambda x: m.whitw((1-nu)/2,x/2,1/(2*b))
     return complex(-derivative(f,eigenval,dx=1e-12))