Beispiel #1
0
def drho_coulombg_rescaled(angL, eta, rho, hvalue, dirvalue):
    return fp.mpf(
        mp.diff(lambda x: mp.coulombg(angL, eta, x),
                rho,
                1,
                h=hvalue,
                direction=dirvalue)) * fp.mpf(mp.coulombc(angL,
                                                          eta)) / eta**angL
Beispiel #2
0
 def test_division(self):
     expr = DivisionExpression(
         SimpleSinExpression(),
         OffsetExpression(SimpleCoshExpression(), 2),
     )
     with mp.workdps(30):
         f = expr.evaluator(use_mp=True)
         space = mp.linspace(0, mp.pi, 10)
         for n in range(1, 5):
             self.assertListAlmostEqual(
                 [f.diff(x, n) for x in space],
                 [mp.diff(f, x, n) for x in space],
                 delta=1e-28,
             )
Beispiel #3
0
def mycoulfg_mix(angL, eta, rho, hvalue, dirvalue):
    if rho > (eta + np.sqrt(eta**2 + angL * (angL + 1))):
        f, df, g, dg, IFAIL = mycoulfg(angL, eta, rho)
        if (IFAIL != 0):
            print(IFAIL)
    else:
        f = fp.mpf(mp.coulombf(angL, eta, rho))
        g = fp.mpf(mp.coulombg(angL, eta, rho))
        df = fp.mpf(
            mp.diff(lambda x: mp.coulombf(angL, eta, x),
                    rho,
                    1,
                    h=hvalue,
                    direction=dirvalue))
        dg = fp.mpf(
            mp.diff(lambda x: mp.coulombg(angL, eta, x),
                    rho,
                    1,
                    h=hvalue,
                    direction=dirvalue))


#    print(f,df,g,dg)
    return f, df, g, dg
Beispiel #4
0
def c1(p):
    return (-1 / (96 * mp.pi() * mp.pi())) * mp.diff(lambda x: c0(x), p, 3)
Beispiel #5
0
coulombf_ufunc = np.frompyfunc(
    lambda angL, eta, rho: fp.mpf(mp.coulombf(angL, eta, rho)), 3,
    1)  # argment: angL, eta, rho=k*r
coulombg_ufunc = np.frompyfunc(
    lambda angL, eta, rho: fp.mpf(mp.coulombg(angL, eta, rho)), 3,
    1)  # argment: angL, eta, rho=k*r
coulombw_ufunc = np.frompyfunc(
    lambda angL, eta, rho: fp.mpf(mp.whitw(eta, angL + 0.5, 2 * rho)), 3,
    1)  # argment: angL, eta, rho=k*r
# argment: angL, eta, rho=k*r, note this order is different from whitw's argument, i
#and there is a factor of 2 for the 3rd argument
drho_coulombf_ufunc = np.frompyfunc(
    lambda angL, eta, rho, hvalue, dirvalue: fp.mpf(
        mp.diff(lambda x: mp.coulombf(angL, eta, x),
                rho,
                1,
                h=hvalue,
                direction=dirvalue)), 5, 1)
drho_coulombg_ufunc = np.frompyfunc(
    lambda angL, eta, rho, hvalue, dirvalue: fp.mpf(
        mp.diff(lambda x: mp.coulombg(angL, eta, x),
                rho,
                1,
                h=hvalue,
                direction=dirvalue)), 5, 1)
drho_coulombw_ufunc = np.frompyfunc(
    lambda angL, eta, rho, hvalue, dirvalue: fp.mpf(
        mp.diff(lambda x: mp.whitw(eta, angL + 0.5, 2 * x),
                rho,
                1,
                h=hvalue,
Beispiel #6
0
    def __init__(self, npts):
        # Legendre poly
        lp = lambda x: mp.legendre(npts, x)

        self.points = mp.polyroots(mp.taylor(lp, 0, npts)[::-1])
        self.weights = [2/((1 - p*p)*mp.diff(lp, p)**2) for p in self.points]
Beispiel #7
0
def c1(p):
   return (-1/(96*PI*PI))*mp.diff(lambda x: c0(x), p, 3)