当前位置: 首页>>代码示例>>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;未经允许,请勿转载。