• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python sympy.roots函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sympy.roots函数的典型用法代码示例。如果您正苦于以下问题:Python roots函数的具体用法?Python roots怎么用?Python roots使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了roots函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: ZPK

    def ZPK(self):
        """Convert to pole-zero-gain (PZK) form.

        See also canonical, general, mixedfrac, and partfrac"""

        N, D, delay = self._as_ratfun_delay()

        K = sym.cancel(N.LC() / D.LC())
        if delay != 0:
            K *= sym.exp(self.var * delay)

        zeros = sym.roots(N)
        poles = sym.roots(D)

        return self.__class__(_zp2tf(zeros, poles, K, self.var))
开发者ID:bcbnz,项目名称:lcapy,代码行数:15,代码来源:core.py


示例2: get_world_segments

def get_world_segments(root_a, root_b, root_c, initial_t, final_t, intersection_radius):
    """
    The world consists of
    three axis lines,
    six circles marking the intersections,
    and a single parametric curve.
    @return: a collection of (p0, p1, style) triples
    """
    seg_length_min = 0.1
    segments = []
    # add the axis line segments
    d = 5
    f_x = pcurve.LineSegment(np.array([-d, 0, 0]), np.array([d, 0, 0]))
    f_y = pcurve.LineSegment(np.array([0, -d, 0]), np.array([0, d, 0]))
    f_z = pcurve.LineSegment(np.array([0, 0, -d]), np.array([0, 0, d]))
    x_axis_segs = pcurve.get_piecewise_curve(f_x, 0, 1, 10, seg_length_min)
    y_axis_segs = pcurve.get_piecewise_curve(f_y, 0, 1, 10, seg_length_min)
    z_axis_segs = pcurve.get_piecewise_curve(f_z, 0, 1, 10, seg_length_min)
    segments.extend((p0, p1, STYLE_X) for p0, p1 in x_axis_segs)
    segments.extend((p0, p1, STYLE_Y) for p0, p1 in y_axis_segs)
    segments.extend((p0, p1, STYLE_Z) for p0, p1 in z_axis_segs)
    # add the parametric curve
    roots = (root_a, root_b, root_c)
    polys = interlace.roots_to_differential_polys(roots)
    f_poly = interlace.Multiplex((sympyutils.WrappedUniPoly(p) for p in polys))
    poly_segs = pcurve.get_piecewise_curve(f_poly, initial_t, final_t, 10, seg_length_min)
    segments.extend((p0, p1, STYLE_CURVE) for p0, p1 in poly_segs)
    # add the intersection circles
    x_roots_symbolic = sympy.roots(polys[0])
    y_roots_symbolic = sympy.roots(polys[1])
    z_roots_symbolic = sympy.roots(polys[2])
    x_roots = [float(r) for r in x_roots_symbolic]
    y_roots = [float(r) for r in y_roots_symbolic]
    z_roots = [float(r) for r in z_roots_symbolic]
    for r in x_roots:
        f = pcurve.OrthoCircle(f_poly(r), intersection_radius, 0)
        segs = pcurve.get_piecewise_curve(f, 0, 1, 10, seg_length_min)
        segments.extend((p0, p1, STYLE_X) for p0, p1 in segs)
    for r in y_roots:
        f = pcurve.OrthoCircle(f_poly(r), intersection_radius, 1)
        segs = pcurve.get_piecewise_curve(f, 0, 1, 10, seg_length_min)
        segments.extend((p0, p1, STYLE_Y) for p0, p1 in segs)
    for r in z_roots:
        f = pcurve.OrthoCircle(f_poly(r), intersection_radius, 2)
        segs = pcurve.get_piecewise_curve(f, 0, 1, 10, seg_length_min)
        segments.extend((p0, p1, STYLE_Z) for p0, p1 in segs)
    # return the segments
    return segments
开发者ID:argriffing,项目名称:xgcode,代码行数:48,代码来源:20110712a.py


示例3: test_legendre

def test_legendre():
    raises(ValueError, lambda: legendre(-1, x))
    assert legendre(0, x) == 1
    assert legendre(1, x) == x
    assert legendre(2, x) == ((3*x**2 - 1)/2).expand()
    assert legendre(3, x) == ((5*x**3 - 3*x)/2).expand()
    assert legendre(4, x) == ((35*x**4 - 30*x**2 + 3)/8).expand()
    assert legendre(5, x) == ((63*x**5 - 70*x**3 + 15*x)/8).expand()
    assert legendre(6, x) == ((231*x**6 - 315*x**4 + 105*x**2 - 5)/16).expand()

    assert legendre(10, -1) == 1
    assert legendre(11, -1) == -1
    assert legendre(10, 1) == 1
    assert legendre(11, 1) == 1
    assert legendre(10, 0) != 0
    assert legendre(11, 0) == 0

    assert roots(legendre(4, x), x) == {
        sqrt(Rational(3, 7) - Rational(2, 35)*sqrt(30)): 1,
        -sqrt(Rational(3, 7) - Rational(2, 35)*sqrt(30)): 1,
        sqrt(Rational(3, 7) + Rational(2, 35)*sqrt(30)): 1,
        -sqrt(Rational(3, 7) + Rational(2, 35)*sqrt(30)): 1,
    }

    n = Symbol("n")

    X = legendre(n, x)
    assert isinstance(X, legendre)

    assert legendre(-n, x) == legendre(n - 1, x)
    assert legendre(n, -x) == (-1)**n*legendre(n, x)
    assert diff(legendre(n, x), x) == \
        n*(x*legendre(n, x) - legendre(n - 1, x))/(x**2 - 1)
    assert diff(legendre(n, x), n) == Derivative(legendre(n, x), n)
开发者ID:Maihj,项目名称:sympy,代码行数:34,代码来源:test_spec_polynomials.py


示例4: test_singularities

    def test_singularities(self):
        S1 = sympify(singularities(f1,x,y))
        S2 = sympify(singularities(f2,x,y))
        S3 = sympify(singularities(f3,x,y))
        S4 = sympify(singularities(f4,x,y))
        S5 = sympify(singularities(f5,x,y))
        S6 = sympify(singularities(f6,x,y))
#         S7 = sympify(singularities(f7,x,y))
#         S8 = sympify(singularities(f8,x,y))
        S9 = sympify(singularities(f9,x,y))
        S10= sympify(singularities(f10,x,y))

        rt5 = sympy.roots(x**2 + 1, x).keys()

        S1act = sympify([
            ((0,0,1),(2,2,1)),
            ((0,1,0),(2,1,2))
            ])
        S2act = sympify([
            ((0,0,1),(3,4,2)),
            ((0,1,0),(4,9,1))
            ])
        S3act = sympify([
            ((0,0,1),(2,1,2)),
            ((1,-1,1),(2,1,2)),
            ((1,1,1),(2,1,2))
            ])
        S4act = sympify([
            ((0,0,1),(2,1,2))
            ])
        S5act = sympify([
            ((0,0,1),(3,3,3)),
            ((1,rt5[1],0),(3,3,3)),
            ((1,rt5[0],0),(3,3,3))
            ])
        S6act = sympify([
            ((0,0,1),(2,2,2)),
            ((1,0,0),(2,2,2))
            ])
#         S7act = sympify([((0,1,0),(3,6,3))])
#         S8act = sympify([
#             ((0,1,0),(6,21,3)),
#             ((1,0,0),(3,7,2))
#             ])
        S9act = sympify([((0,1,0),(5,12,1))])
        S10act= sympify([
            ((0,1,0),(3,6,1)),
            ((1,0,0),(4,6,4))
            ])

        self.assertItemsEqual(S1,S1act)
        self.assertItemsEqual(S2,S2act)
        self.assertItemsEqual(S3,S3act)
        self.assertItemsEqual(S4,S4act)
        self.assertItemsEqual(S5,S5act)
        self.assertItemsEqual(S6,S6act)
#         self.assertItemsEqual(S7,S7act)
#         self.assertItemsEqual(S8,S8act)
        self.assertItemsEqual(S9,S9act)
        self.assertItemsEqual(S10,S10act)
开发者ID:mkaralus,项目名称:abelfunctions,代码行数:60,代码来源:test_singularities.py


示例5: test_singular_points

    def test_singular_points(self):
        S1 = singularities(f1,x,y)
        S2 = singularities(f2,x,y)
        S3 = singularities(f3,x,y)
        S4 = singularities(f4,x,y)
        S5 = singularities(f5,x,y)
        S6 = singularities(f6,x,y)
        S7 = singularities(f7,x,y)
        S8 = singularities(f8,x,y)
        S9 = singularities(f9,x,y)
        S10= singularities(f10,x,y)

        rt5 = [rt for rt,_ in sympy.roots(x**2 + 1, x).iteritems()]

        S1act = [(0,0,1),(0,1,0)]
        S2act = [(0,0,1),(0,1,0)]
        S3act = [(0,0,1),(1,-1,1),(1,1,1)]
        S4act = [(0,0,1)]
        S5act = [(0,0,1),(rt5[0],1,0),(rt5[1],1,0)]
        S6act = [(0,0,1),(1,0,0)]
        S7act = [(0,1,0)]
        S8act = [(0,1,0),(1,0,0)]
        S9act = [(0,1,0)]
        S10act= [(0,1,0),(1,0,0)]

        self.assertItemsEqual(S1,S1act)
        self.assertItemsEqual(S2,S2act)
        self.assertItemsEqual(S3,S3act)
        self.assertItemsEqual(S4,S4act)
        self.assertItemsEqual(S5,S5act)
        self.assertItemsEqual(S6,S6act)
        self.assertItemsEqual(S7,S7act)
        self.assertItemsEqual(S8,S8act)
        self.assertItemsEqual(S9,S9act)
        self.assertItemsEqual(S10,S10act)
开发者ID:gradyrw,项目名称:abelfunctions,代码行数:35,代码来源:test_singularities.py


示例6: ZPK

    def ZPK(self):
        """Convert to pole-zero-gain (PZK) form.

        See also canonical, general, mixedfrac, and partfrac"""

        N, D, delay, undef = self.as_ratfun_delay_undef()

        var = self.var        
        Npoly = sym.Poly(N, var)
        Dpoly = sym.Poly(D, var)
        
        K = sym.cancel(Npoly.LC() / Dpoly.LC())
        if delay != 0:
            K *= sym.exp(self.var * delay)

        zeros = sym.roots(Npoly)
        poles = sym.roots(Dpoly)

        return _zp2tf(zeros, poles, K, self.var) * undef
开发者ID:mph-,项目名称:lcapy,代码行数:19,代码来源:ratfun.py


示例7: test_roots_to_poly

 def test_roots_to_poly(self):
     roots = (1.0, 4.0, 5.0)
     p = sympyutils.roots_to_poly(roots)
     self.assertTrue(p.is_monic)
     root_to_count = sympy.roots(p)
     self.assertEqual(set(root_to_count.values()), set([1]))
     observed = set(root_to_count.keys())
     expected = set(roots)
     for r_observed, r_expected in zip(sorted(observed), sorted(expected)):
         self.assertAlmostEqual(r_observed, r_expected)
开发者ID:argriffing,项目名称:xgcode,代码行数:10,代码来源:interlace.py


示例8: run_copper_smith

def run_copper_smith(f, N, h, k):
    X = s.S(s.ceiling((s.Pow(2, - 1 / 2) * s.Pow(h * k, -1 / (h * k - 1))) *
                      s.Pow(N, (h - 1) / (h * k - 1))) - 1)
    gen = lll(generate(f, N, h, k, X), s.S(0.75))
    final_poly = [gen[0][i] / s.Pow(X, i) for i in range(len(gen[0]))][::-1]

    roots = s.roots(final_poly)
    for r in roots:
        print(r)

    return roots
开发者ID:masterjonny,项目名称:furry-octo-wookie,代码行数:11,代码来源:copper_smith.py


示例9: singular_term

def singular_term(F,X,Y,L,I,version):
    """
    Computes a single set of singular terms of the Puiseux expansions.

    For `I=1`, the function computes the first term of each finite 
    `\mathbb{K}` expansion. For `I=2`, it computes the other terms of the
    expansion.
    """
    T = []

    # if the curve is singular then compute the singular tuples
    # otherwise, use the standard newton polygon method
    if is_singular(F,X,Y):
        for (q,m,l,Phi) in desingularize(F,X,Y):
            for eta in Phi.all_roots(radicals=True):
                tau = (q,1,m,1,sympy.together(eta))
                T.append((tau,0,1))
    else:
        # each side of the newton polygon corresponds to a K-term.
        for (q,m,l,Phi) in polygon(F,X,Y,I):
            # the rational method
            if version == 'rational':
                u,v = _bezout(q,m)      

            # each newton polygon side has a characteristic
            # polynomial. For each square-free factor, each root
            # corresponds to a K-term
            for (Psi,r) in _square_free(Phi,_Z):
                Psi = sympy.Poly(Psi,_Z)
                
                # compute the roots of Psi. Use the RootOf construct if 
                # possible. In the case when Psi is over EX (i.e. when
                # RootOf doesn't work) then compute symbolic roots.
                try:
                    roots = Psi.all_roots(radicals=True)
                except NotImplementedError:
                    roots = sympy.roots(Psi,_Z).keys()

                for xi in roots:
                    # the classical version returns the "raw" roots
                    if version == 'classical':
                        P = sympy.Poly(_U**q-xi,_U)
                        beta = RootOf(P,0,radicals=True)
                        tau = (q,1,m,beta,1)
                        T.append((tau,l,r))
                    # the rational version rescales parameters so as
                    # to include ony rational terms in the Puiseux
                    # expansions.
                    if version == 'rational':
                        mu = xi**(-v)
                        beta = sympy.together(xi**u)
                        tau = (q,mu,m,beta,1)
                        T.append((tau,l,r))
    return T
开发者ID:gradyrw,项目名称:abelfunctions,代码行数:54,代码来源:puiseux.py


示例10: _singular_points_finite

def _singular_points_finite(f,x,y):
    """
    Returns the finite singular points of f.
    """
    S = []

    # compute the finite singularities: use the resultant
    p  = sympy.Poly(f,[x,y])
    n  = p.degree(y)

    res = sympy.Poly(sympy.resultant(p,p.diff(y),y),x)
    for xk,deg in sympy.roots(res,x).iteritems():
        if deg > 1:
            fxk = sympy.Poly(f.subs({x:xk,y:_Z}), _Z)
            for ykj,_ in sympy.roots(fxk, _Z).iteritems():
                fx = f.diff(x)
                fy = f.diff(y)
                subs = {x:xk,y:ykj}
                if (fx.subs(subs) == 0) and (fy.subs(subs) == 0):
                    S.append((xk,ykj,1))

    return S
开发者ID:mkaralus,项目名称:abelfunctions,代码行数:22,代码来源:singularities.py


示例11: fund_ries

def fund_ries(drc):
    a2,a1,a0 = drc
    r = roots(a2*t**2 + a1*t +a0,t)
    kl = list(r.keys())
    if len(kl) == 2:  # jednoduche korene
        r1,r2 = kl        
        re_k,im_k = r1.as_real_imag()
        if im_k == 0: # jednoduche realne korene
            return exp(r1*t), exp(r2*t)
        else:         # komplexne zdruz.korene
            return exp(re_k*t)*sin(im_k*t), exp(re_k*t)*cos(im_k*t)
    else: # dvojnasobny koren
        return exp(kl[0]*t), t*exp(kl[0]*t)
开发者ID:misolietavec,项目名称:notebooks_MA2,代码行数:13,代码来源:varkonst.py


示例12: _singular_points_infinite

def _singular_points_infinite(f,x,y):
    """
    Returns the singular points of f at infinity.
    """
    S = []

    # compute homogenous polynomial
    F, d = homogenize(f,x,y,_z)

    # find singular points at infinity
    F0 = sympy.Poly(F.subs([(_z,0)]),[x,y])
    domain = sympy.QQ[sympy.I]
    solsX1 = sympy.roots(F0.subs({x:1,y:_Z}),_Z).keys()
    solsY1 = sympy.roots(F0.subs({y:1,x:_Z}),_Z).keys()

    all_sols = [ (1,yi,0) for yi in solsX1 ]
    all_sols.extend( [ (xi,1,0) for xi in solsY1 ] )

    # these points are in projective space, so filter out equal points
    # such as (1,I,0) == (-I,1,0). We normalize these projective
    # points such that 1 appears in either the x- or y- coordinate
    sols = []
    for xi,yi,zi in all_sols:
        normalized = (1,yi/xi,0) if xi != sympy.S(0) else (xi/yi,1,0)
        if not normalized in sols:
            sols.append(normalized)

    # Filter out any points that are not singular by checking if the
    # gradient vanishes.
    grad = [F.diff(var) for var in [x,y,_z]]
    for xi,yi,zi in sols:
        fsub = lambda e,x=x,y=y,_z=_z,xi=xi,yi=yi,zi=zi:  \
               e.subs({x:xi,y:yi,_z:zi}).simplify() != sympy.S(0)
        if not any(map(fsub,grad)):
            S.append((xi,yi,zi))

    return S
开发者ID:mkaralus,项目名称:abelfunctions,代码行数:37,代码来源:singularities.py


示例13: tustin

def tustin(tf, sRate):
	s =	getMapping(tf)['s']
	T = 1/sRate
	poles = sympy.roots(sympy.denom(tf), s, multiple=True)
	centroid = np.mean(np.abs(poles))
	invz = sympy.Symbol('invz', real=True)
	# normalized center frequency derived from poles of filter SISO transfer function
	w0 = 2*np.pi*centroid/(sRate*2*np.pi)
	# modified bilinear transform w/ frequency warping
	bt = w0/sympy.tan(w0*T/2) * ((1-invz)/(1+invz))
	dt = sympy.simplify(tf.subs({s: bt}))
	b = sympy.Poly(sympy.numer(dt)).all_coeffs()[::-1]
	a = sympy.Poly(sympy.denom(dt)).all_coeffs()[::-1]
	normalize = lambda x: float(x/a[0])
	return (map(normalize, b), map(normalize, a))
开发者ID:itdaniher,项目名称:ahkab-notebook,代码行数:15,代码来源:ahkabHelpers.py


示例14: test_ndiff_roots_symbolic

 def test_ndiff_roots_symbolic(self):
     roots = (1.25, 4.5, 5.75)
     a, b, c = roots
     polys = roots_to_differential_polys(roots)
     # compute linear root manually
     r = float(a + b + c) / 3
     # check linear root
     observed = sorted(float(r) for r in sympy.roots(polys[0]))
     expected = sorted([r])
     self.assertTrue(np.allclose(observed, expected))
     # compute quadratic roots manually
     A = a*a + b*b + c*c
     B = a*b + a*c + b*c
     S = a + b + c
     r0 = float(S + math.sqrt(A - B)) / 3
     r1 = float(S - math.sqrt(A - B)) / 3
     # check quadratic roots
     observed = sorted(float(r) for r in sympy.roots(polys[1]))
     expected = sorted([r0, r1])
     self.assertTrue(np.allclose(observed, expected))
     # check cubic roots
     observed = sorted(float(r) for r in sympy.roots(polys[2]))
     expected = sorted(roots)
     self.assertTrue(np.allclose(observed, expected))
开发者ID:argriffing,项目名称:xgcode,代码行数:24,代码来源:interlace.py


示例15: get_segmentation

def get_segmentation(p, t0, t1):
    """
    A segmentation is a sequence of triples (left, right, sign).
    @param p: a sympy Poly
    @param t0: initial time
    @param t1: final time
    @return: a segmentation
    """
    roots = sorted(float(r) for r in sympy.roots(p))
    points = [t0] + roots + [t1]
    segmentation = []
    for left, right in iterutils.pairwise(points):
        mid = (left + right) / 2
        sign = -1 if p.eval(mid) <= 0 else 1
        seg = (left, right, sign)
        segmentation.append(seg)
    return segmentation
开发者ID:argriffing,项目名称:xgcode,代码行数:17,代码来源:20110719a.py


示例16: test_poly

def test_poly():
    output("""\
    poly_:{
        r:{$[prec>=abs(x:reim x)1;x 0;x]} each .qml.poly x;
        r iasc {x:reim x;(abs x 1;neg x 1;x 0)} each r};""")

    for A in poly_subjects:
        A = sp.Poly(A, sp.Symbol("x"))
        if A.degree() <= 3 and all(a.is_real for a in A.all_coeffs()):
            R = []
            for r in sp.roots(A, multiple=True):
                r = sp.simplify(sp.expand_complex(r))
                R.append(r)
            R.sort(key=lambda x: (abs(sp.im(x)), -sp.im(x), sp.re(x)))
        else:
            R = mp.polyroots([mp.mpc(*(a.evalf(mp.mp.dps)).as_real_imag())
                              for a in A.all_coeffs()])
            R.sort(key=lambda x: (abs(x.imag), -x.imag, x.real))
        assert len(R) == A.degree()
        test("poly_", A.all_coeffs(), R, complex_pair=True)
开发者ID:zholos,项目名称:qml,代码行数:20,代码来源:mpmat.py


示例17: given

def given():
    xp0 = randrange(7, 10)
    pmax = randrange(7, 10)
    Ep = R(-pmax, xp0) * x + pmax
    E = sympy.integrate(Ep, x)
    b = randrange(2, xp0 - 2)
    cmax = int(Ep.subs(x, b).n())
    c = randrange(1, cmax)
    a = R(randrange(1, pmax - c), b * b)
    Kp = a * (x - b) ** 2 + c
    Gp = Ep - Kp
    rG = [r.n() for r in sympy.roots(Gp) if r > 0][0]
    G = sympy.integrate(Gp, x)
    mG = G.subs(x, rG)
    Ko = int(mG - 1) / 2
    #K = sympy.integrate(Kp,x)+Ko
    #G = E.n()-K.n()
    #rts = sorted([r.n() for r in sympy.roots(G) if r > 0])
    g = Struct(pmax=pmax, xp0=xp0, Ko=Ko, Kp=sympy.sstr(Kp))
    return g
开发者ID:mamchecker,项目名称:mamchecker,代码行数:20,代码来源:__init__.py


示例18: test_legendre

def test_legendre():
    assert legendre(0, x) == 1
    assert legendre(1, x) == x
    assert legendre(2, x) == ((3*x**2-1)/2).expand()
    assert legendre(3, x) == ((5*x**3-3*x)/2).expand()
    assert legendre(4, x) == ((35*x**4-30*x**2+3)/8).expand()
    assert legendre(5, x) == ((63*x**5-70*x**3+15*x)/8).expand()
    assert legendre(6, x) == ((231*x**6-315*x**4+105*x**2-5)/16).expand()

    assert legendre(10, -1) == 1
    assert legendre(11, -1) == -1
    assert legendre(10, 1) == 1
    assert legendre(11, 1) == 1
    assert legendre(10, 0) != 0
    assert legendre(11, 0) == 0

    assert roots(legendre(4,x), x) == {
         sqrt(Rational(3, 7) - Rational(2, 35)*sqrt(30)): 1,
        -sqrt(Rational(3, 7) - Rational(2, 35)*sqrt(30)): 1,
         sqrt(Rational(3, 7) + Rational(2, 35)*sqrt(30)): 1,
        -sqrt(Rational(3, 7) + Rational(2, 35)*sqrt(30)): 1,
    }
开发者ID:101man,项目名称:sympy,代码行数:22,代码来源:test_spec_polynomials.py


示例19: get_pane_tikz_lines

def get_pane_tikz_lines(poly_pair, color_pair, t0, t1):
    """
    This is called maybe three times.
    @param poly_pair: the lower and higher order Poly objects
    @param color_pair: the polynomial colors
    @param t0: initial time
    @param t1: final time
    @return: a list of tikz lines
    """
    lines = []
    pa, pb = poly_pair
    ca, cb = color_pair
    # draw the segmentation corresponding to the lower order polynomial
    for left, right, sign in get_segmentation(pa, t0, t1):
        width = {-1: "0.5mm", 1: "2mm"}[sign]
        line = "\\draw[color=%s,line width=%s] (%s, 0) -- (%s, 0);" % (ca, width, left, right)
        lines.append(line)
    # draw the cuts corresponding to the higher order polynomial
    for r in sorted(sympy.roots(pb)):
        cut = float(r)
        line = "\\draw[color=%s,line width=0.5mm] (%s, -3mm) -- (%s, 3mm);" % (cb, cut, cut)
        lines.append(line)
    return lines
开发者ID:argriffing,项目名称:xgcode,代码行数:23,代码来源:20110719a.py


示例20: coefficient

def coefficient(polinom_in):
    """

    :param polinom_in:
    :return:
    """
    edge_dot = []
    polinom_antispace = re.sub(r'\s', '', polinom_in)
    edge_y = test_eval(0, polinom_antispace) # нахождение максимального y при x=0
    edge_y = edge_y * 1.03
    r = roots(polinom_antispace) #получаю словарь возможных корней(пересечение с x)
    edge_list_x = []
    for k in r.keys():
        if k.__class__.__name__ == "Float":
            if float(k) > 0:
                edge_list_x.append(float(k))

    edge_x = min(edge_list_x)
    edge_x = edge_x * 1.03
    print edge_x
    edge_dot.append(edge_x)
    edge_dot.append(edge_y)
    return edge_dot  # возвращает список с точкой пересечения оси икс и игрик
开发者ID:rtut,项目名称:little_programm,代码行数:23,代码来源:mamt_pump.py



注:本文中的sympy.roots函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sympy.sec函数代码示例发布时间:2022-05-27
下一篇:
Python sympy.root函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap