Example #1
0
    def __init__(self,N=100,L=10.0,d=1,q=1):
        self.N = N
        self.L = L
        self.d = d
        self.radial = True
        x = np.linspace(L,0,N,endpoint=False)[::-1]
        

        method = 'uniform'
        method = 'geometric'
        if method == 'uniform':
            x = np.linspace(L,0,N,endpoint=False)[::-1]
        elif method == 'geometric':
            x = np.linspace(1,0,N,endpoint=False)[::-1]
            x = x**q
            x = x*L
        else:
            n = int(np.floor(np.log2(N)))
            kappa = 1/4
            x = np.array([kappa*L,L])
            for i in range(n):
                y = (x[1:-1] + x[2:])/2
                x = np.hstack((x,y,kappa*x[0]))
                x.sort()
            self.N = len(x)
            N = self.N

        if d==1:
            x = np.linspace(-L/2,L/2,N)
        
        self.deltam = np.zeros_like(x)
        self.deltam[1:] = x[1:] - x[:-1]
        # cas particulier d = 1
        if d == 1:
            self.deltam[0] = self.deltam[1]
        else:
            self.deltam[0] = x[0]


        self.deltap = np.zeros_like(self.deltam)
        self.deltap[:-1]= self.deltam[1:]
        self.deltap[-1] = self.deltam[-1]
        self.delta = (self.deltap+self.deltam)/2


        # fd ou fe. d=2, l=0 est hard-code
        self.method = 'fe'

        self.x = x
        if d == 1:
            self.ds = np.ones_like(x)
        else:
            self.ds = functions.surf_nsphere(d) * x**(d-1)
Example #2
0
def integral(gam,d):
    return surf_nsphere(d) / 2 * gamma(gam+d/2+1)*gamma(d/2)/gamma(gam+d+1)