Python scipy.special.ellipe() Examples
The following are 15
code examples of scipy.special.ellipe().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
scipy.special
, or try the search function
.
Example #1
Source File: test_basic.py From GraphicDesignPatternByPython with MIT License | 6 votes |
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)
Example #2
Source File: gradshafranov.py From freegs with GNU Lesser General Public License v3.0 | 6 votes |
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
Example #3
Source File: test_basic.py From Computable with MIT License | 5 votes |
def test_ellipe(self): assert_equal(cephes.ellipe(1),1.0)
Example #4
Source File: test_basic.py From Computable with MIT License | 5 votes |
def test_ellipe(self): ele = special.ellipe(.2) assert_almost_equal(ele,1.4890350580958529,8)
Example #5
Source File: test_basic.py From Computable with MIT License | 5 votes |
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)
Example #6
Source File: test_mpmath.py From Computable with MIT License | 5 votes |
def test_ellipe(self): assert_mpmath_equal(sc.ellipe, mpmath.ellipe, [Arg()])
Example #7
Source File: test_basic.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def test_ellipe(self): assert_equal(cephes.ellipe(1),1.0)
Example #8
Source File: test_basic.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def test_ellipe(self): ele = special.ellipe(.2) assert_almost_equal(ele,1.4890350580958529,8) assert_equal(special.ellipe(0.0), pi/2) assert_equal(special.ellipe(1.0), 1.0) assert_equal(special.ellipe(-np.inf), np.inf) assert_equal(special.ellipe(np.nan), np.nan) assert_equal(special.ellipe(2), np.nan) assert_allclose(special.ellipe(-10), 3.6391380384177689)
Example #9
Source File: test_mpmath.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def test_ellipe(self): assert_mpmath_equal(sc.ellipe, mpmath.ellipe, [Arg(b=1.0)])
Example #10
Source File: test_mpmath.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def test_ellipeinc(self): assert_mpmath_equal(sc.ellipeinc, mpmath.ellipe, [Arg(-1e3, 1e3), Arg(b=1.0)])
Example #11
Source File: __init__.py From fluids with MIT License | 5 votes |
def ellipe(m): from scipy.special import ellipe return ellipe(m)
Example #12
Source File: __init__.py From fluids with MIT License | 5 votes |
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
Example #13
Source File: __init__.py From fluids with MIT License | 5 votes |
def ellipe(*args, **kwargs): import mpmath return mpmath.ellipe(*args, **kwargs)
Example #14
Source File: __init__.py From fluids with MIT License | 5 votes |
def ellipeinc(phi, m): import mpmath return mpmath.ellipe.ellipeinc(phi, m)
Example #15
Source File: ellipse.py From meshzoo with GNU General Public License v3.0 | 5 votes |
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)