当前位置: 首页>>代码示例>>Python>>正文


Python Poly.coeffs方法代码示例

本文整理汇总了Python中sympy.Poly.coeffs方法的典型用法代码示例。如果您正苦于以下问题:Python Poly.coeffs方法的具体用法?Python Poly.coeffs怎么用?Python Poly.coeffs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sympy.Poly的用法示例。


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

示例1: main

# 需要导入模块: from sympy import Poly [as 别名]
# 或者: from sympy.Poly import coeffs [as 别名]
def main():
    x=Symbol("x")
    s = Poly(A(x), x)
    num = list(reversed(s.coeffs()))[:11]

    print s.as_basic()
    print num
开发者ID:Aang,项目名称:sympy,代码行数:9,代码来源:trees.py

示例2: discrete_realization_tustin

# 需要导入模块: from sympy import Poly [as 别名]
# 或者: from sympy.Poly import coeffs [as 别名]
def discrete_realization_tustin(n0, n1, d0, T):
    z = symbols('z')
    s = 2/T*(z-1)/(z+1)
    num = ((n1*s + n0)*T*(z + 1)).simplify()
    den = ((s + d0)*T*(z + 1)).simplify()
    num_poly = Poly(num, z)
    den_poly = Poly(den, z)

    n1_z, n0_z = num_poly.coeffs()
    d1_z, d0_z = den_poly.coeffs()

    # Make denominator monic and divide numerator appropriately
    n1_z /= d1_z
    n0_z /= d1_z
    d0_z /= d1_z

    a = -d0_z
    b_times_c = (n0_z - n1_z * d0_z).simplify()
    d = n1_z

    return a, b_times_c, d
开发者ID:hazelnusse,项目名称:robot.bicycle,代码行数:23,代码来源:derivative_filter.py

示例3: mprint

# 需要导入模块: from sympy import Poly [as 别名]
# 或者: from sympy.Poly import coeffs [as 别名]
# See equations 4.4.3 and  4.11.4 of Kane & Levinson
Fr_c = Fr_u[:3, :].col_join(Fr_u[6:, :]) + A_rs.T * Fr_u[3:6, :]
Fr_star_c = Fr_star_u[:3, :].col_join(Fr_star_u[6:, :])\
            + A_rs.T * Fr_star_u[3:6, :]
Fr_star_steady = Fr_star_c.subs(ud_zero).subs(u_dep_dict)\
        .subs(steady_conditions).subs({q[3]: -r*cos(q[1])}).expand()

mprint(Fr_c)
mprint(Fr_star_steady)

# First dynamic equation, under steady conditions is 2nd order polynomial in
# dq0/dt.
steady_turning_dynamic_equation = Fr_c[0] + Fr_star_steady[0]
# Equilibrium is posible when the solution to this quadratic is real, i.e.,
# when the discriminant in the quadratic is non-negative
p = Poly(steady_turning_dynamic_equation, qd[0])
a, b, c = p.coeffs()
discriminant = b*b - 4*a*c      # Must be non-negative for equilibrium
# in case of thin disc inertia assumptions
#mprint((discriminant / (r**3 * m**2)).expand())


# ADD ALL CODE DIRECTLY BELOW HERE, do not change above!
# Think there should be at 12 assertion tests:
# 1) Fr[i] == fr from KanesMethod  i = 0, ..., 5
# 2) Fr_star[i] == frstar from KanesMethod i = 0, ..., 5
# if 2) is slow, try comparing this instead:
# 2a) Fr_star_steady[i] == frstar from KanesMethod, evaluated at steady turning
# conditions.
# This should be something like frstar.subs(ud_zero).subs(steady_conditions)
开发者ID:Nitin216,项目名称:pydy,代码行数:32,代码来源:rollingdisc_nonminimal.py

示例4: symbols

# 需要导入模块: from sympy import Poly [as 别名]
# 或者: from sympy.Poly import coeffs [as 别名]
import numpy as np

a, b, T, s, w, x, z, I = symbols('a b T s w x z I')
bilinear_transform = {s : 2/T*(z-1)/(z+1)}

# Continuous time transfer function from I(s) to w(s) of the following plant
# model:
#   dw/dt = a*w + b*I
G_s = b/(s-a)

G_z_num, G_z_den = G_s.subs(bilinear_transform).as_numer_denom()
G_z_den = Poly(G_z_den, z)

G_z_num = Poly(G_z_num / G_z_den.LC(), z) # divide by leading coefficient of den
G_z_den = G_z_den.monic()                 # make denominator monic
assert(G_z_den.coeffs()[0] == 1)

kp = Poly(G_z_num.coeffs()[0], z)

G_z_N_p = G_z_num - kp * G_z_den

print(kp)
print(G_z_N_p)
print(G_z_den)
from sympy import symbols, Poly
import numpy as np

a, b, T, s, w, x, z, I = symbols('a b T s w x z I')
bilinear_transform = {s : 2/T*(z-1)/(z+1)}

# Continuous time transfer function from I(s) to w(s) of the following plant
开发者ID:hazelnusse,项目名称:robot.bicycle,代码行数:33,代码来源:speed_controller.py


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