當前位置: 首頁>>代碼示例>>Python>>正文


Python special.ellipe方法代碼示例

本文整理匯總了Python中scipy.special.ellipe方法的典型用法代碼示例。如果您正苦於以下問題:Python special.ellipe方法的具體用法?Python special.ellipe怎麽用?Python special.ellipe使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在scipy.special的用法示例。


在下文中一共展示了special.ellipe方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_ellipeinc

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import ellipe [as 別名]
def test_ellipeinc(self):
        eleinc = special.ellipeinc(pi/2,.2)
        ele = special.ellipe(0.2)
        assert_almost_equal(eleinc,ele,14)
        # pg 617 of A & S
        alpha, phi = 52*pi/180,35*pi/180
        m = sin(alpha)**2
        eleinc = special.ellipeinc(phi,m)
        assert_almost_equal(eleinc, 0.58823065, 8)

        assert_equal(special.ellipeinc(pi/2, 0.0), pi/2)
        assert_equal(special.ellipeinc(pi/2, 1.0), 1.0)
        assert_equal(special.ellipeinc(pi/2, -np.inf), np.inf)
        assert_equal(special.ellipeinc(pi/2, np.nan), np.nan)
        assert_equal(special.ellipeinc(pi/2, 2), np.nan)
        assert_equal(special.ellipeinc(0, 0.5), 0.0)
        assert_equal(special.ellipeinc(np.inf, 0.5), np.inf)
        assert_equal(special.ellipeinc(-np.inf, 0.5), -np.inf)
        assert_equal(special.ellipeinc(np.inf, -np.inf), np.inf)
        assert_equal(special.ellipeinc(-np.inf, -np.inf), -np.inf)
        assert_equal(special.ellipeinc(np.inf, np.inf), np.nan)
        assert_equal(special.ellipeinc(-np.inf, np.inf), np.nan)
        assert_equal(special.ellipeinc(np.nan, 0.5), np.nan)
        assert_equal(special.ellipeinc(np.nan, np.nan), np.nan)
        assert_allclose(special.ellipeinc(1.5707, -10), 3.6388185585822876) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:27,代碼來源:test_basic.py

示例2: Greens

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import ellipe [as 別名]
def Greens(Rc, Zc, R, Z):
    """
    Calculate poloidal flux at (R,Z) due to a unit current
    at (Rc,Zc) using Greens function
    
    """

    # Calculate k^2
    k2 = 4.*R * Rc / ( (R + Rc)**2 + (Z - Zc)**2 )

    # Clip to between 0 and 1 to avoid nans e.g. when coil is on grid point
    k2 = clip(k2, 1e-10, 1.0 - 1e-10)
    k = sqrt(k2)

    # Note definition of ellipk, ellipe in scipy is K(k^2), E(k^2)
    return (mu0/(2.*pi)) * sqrt(R*Rc) * ( (2. - k2)*ellipk(k2) - 2.*ellipe(k2) ) / k 
開發者ID:bendudson,項目名稱:freegs,代碼行數:18,代碼來源:gradshafranov.py

示例3: test_ellipe

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import ellipe [as 別名]
def test_ellipe(self):
        assert_equal(cephes.ellipe(1),1.0) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:4,代碼來源:test_basic.py

示例4: test_ellipeinc

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import ellipe [as 別名]
def test_ellipeinc(self):
        eleinc = special.ellipeinc(pi/2,.2)
        ele = special.ellipe(0.2)
        assert_almost_equal(eleinc,ele,14)
        # pg 617 of A & S
        alpha, phi = 52*pi/180,35*pi/180
        m = sin(alpha)**2
        eleinc = special.ellipeinc(phi,m)
        assert_almost_equal(eleinc, 0.58823065, 8) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:11,代碼來源:test_basic.py

示例5: test_ellipe

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import ellipe [as 別名]
def test_ellipe(self):
        assert_mpmath_equal(sc.ellipe,
                            mpmath.ellipe,
                            [Arg()]) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:6,代碼來源:test_mpmath.py

示例6: test_ellipe

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import ellipe [as 別名]
def test_ellipe(self):
        assert_mpmath_equal(sc.ellipe,
                            mpmath.ellipe,
                            [Arg(b=1.0)]) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:6,代碼來源:test_mpmath.py

示例7: test_ellipeinc

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import ellipe [as 別名]
def test_ellipeinc(self):
        assert_mpmath_equal(sc.ellipeinc,
                            mpmath.ellipe,
                            [Arg(-1e3, 1e3), Arg(b=1.0)]) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:6,代碼來源:test_mpmath.py

示例8: ellipe

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import ellipe [as 別名]
def ellipe(m):
        from scipy.special import ellipe
        return ellipe(m) 
開發者ID:CalebBell,項目名稱:fluids,代碼行數:5,代碼來源:__init__.py

示例9: erf

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import ellipe [as 別名]
def erf(*args, **kwargs):
            from scipy.special import erf
            return erf(*args, **kwargs)


#    from scipy.special import lambertw, ellipe, gammaincc, gamma # fluids
#    from scipy.special import i1, i0, k1, k0, iv # ht
#    from scipy.special import hyp2f1    
#    if erf is None:
#        from scipy.special import erf 
開發者ID:CalebBell,項目名稱:fluids,代碼行數:12,代碼來源:__init__.py

示例10: ellipeinc

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import ellipe [as 別名]
def ellipeinc(phi, m):
        import mpmath
        return mpmath.ellipe.ellipeinc(phi, m) 
開發者ID:CalebBell,項目名稱:fluids,代碼行數:5,代碼來源:__init__.py

示例11: create_mesh

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import ellipe [as 別名]
def create_mesh(axis0=1, axis1=0.5, num_boundary_points=100):
    # lengths of major and minor axes
    a = max(axis0, axis1)
    b = min(axis0, axis1)

    # Choose the maximum area of a triangle equal to the area of
    # an equilateral triangle on the boundary.
    # For circumference of an ellipse, see
    # http://en.wikipedia.org/wiki/Ellipse#Circumference
    eccentricity = np.sqrt(1.0 - (b / a) ** 2)
    length_boundary = float(4 * a * special.ellipe(eccentricity))
    a_boundary = length_boundary / num_boundary_points
    max_area = a_boundary ** 2 * np.sqrt(3) / 4

    # generate points on the circle
    Phi = np.linspace(0, 2 * np.pi, num_boundary_points, endpoint=False)
    boundary_points = np.column_stack((a * np.cos(Phi), b * np.sin(Phi)))

    info = meshpy.triangle.MeshInfo()
    info.set_points(boundary_points)

    def _round_trip_connect(start, end):
        result = []
        for i in range(start, end):
            result.append((i, i + 1))
        result.append((end, start))
        return result

    info.set_facets(_round_trip_connect(0, len(boundary_points) - 1))

    def _needs_refinement(vertices, area):
        return bool(area > max_area)

    meshpy_mesh = meshpy.triangle.build(info, refinement_func=_needs_refinement)

    # append column
    pts = np.array(meshpy_mesh.points)
    points = np.c_[pts[:, 0], pts[:, 1], np.zeros(len(pts))]

    return points, np.array(meshpy_mesh.elements) 
開發者ID:nschloe,項目名稱:meshzoo,代碼行數:42,代碼來源:ellipse.py


注:本文中的scipy.special.ellipe方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。