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


Python Matrix.col_join方法代码示例

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


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

示例1: Matrix

# 需要导入模块: from sympy import Matrix [as 别名]
# 或者: from sympy.Matrix import col_join [as 别名]
print 'Qb: ',Qb
QsT = Matrix([B.transpose(),\
             (A*B).transpose(),\
             (A**2*B).transpose(),\
             (A**3*B).transpose()])
Qs = QsT.transpose()
print 'Qs: ',Qs
print 'A: ',A
print 'B: ',B
print 'C: ',C


'''
Nachweis der Steuerbarkeit des erweiterten Zustandsraummodells
'''
Aquer = A.col_join(C).row_join(sp.zeros(5,1))
Bquer = B.col_join(sp.zeros(1,1))
Cquer = C.row_join(sp.zeros(1,1))


'''
Übertragungsfunktion des Linearisierten Systems
'''
G = C*(sp.eye(4)*s - A)**-1*B

# Steuerbarkeitsmatrix berechnen
n = 5
Qsquer = sp.Matrix()
for i in range(5):
    q = (Aquer**i)*Bquer
    if len(Qsquer) == 0:
开发者ID:cklb,项目名称:pymoskito,代码行数:33,代码来源:linearization_separate.py

示例2: SymbolicSystem

# 需要导入模块: from sympy import Matrix [as 别名]
# 或者: from sympy.Matrix import col_join [as 别名]

#.........这里部分代码省略.........
    Notes
    =====

    m : number of generalized speeds
    n : number of generalized coordinates
    o : number of states

    """

    def __init__(self, coord_states, right_hand_side, speeds=None,
                 mass_matrix=None, coordinate_derivatives=None, alg_con=None,
                 output_eqns={}, coord_idxs=None, speed_idxs=None, bodies=None,
                 loads=None):
        """Initializes a SymbolicSystem object"""

        # Extract information on speeds, coordinates and states
        if speeds is None:
            self._states = Matrix(coord_states)

            if coord_idxs is None:
                self._coordinates = None
            else:
                coords = [coord_states[i] for i in coord_idxs]
                self._coordinates = Matrix(coords)

            if speed_idxs is None:
                self._speeds = None
            else:
                speeds_inter = [coord_states[i] for i in speed_idxs]
                self._speeds = Matrix(speeds_inter)
        else:
            self._coordinates = Matrix(coord_states)
            self._speeds = Matrix(speeds)
            self._states = self._coordinates.col_join(self._speeds)

        # Extract equations of motion form
        if coordinate_derivatives is not None:
            self._kin_explicit_rhs = coordinate_derivatives
            self._dyn_implicit_rhs = right_hand_side
            self._dyn_implicit_mat = mass_matrix
            self._comb_implicit_rhs = None
            self._comb_implicit_mat = None
            self._comb_explicit_rhs = None
        elif mass_matrix is not None:
            self._kin_explicit_rhs = None
            self._dyn_implicit_rhs = None
            self._dyn_implicit_mat = None
            self._comb_implicit_rhs = right_hand_side
            self._comb_implicit_mat = mass_matrix
            self._comb_explicit_rhs = None
        else:
            self._kin_explicit_rhs = None
            self._dyn_implicit_rhs = None
            self._dyn_implicit_mat = None
            self._comb_implicit_rhs = None
            self._comb_implicit_mat = None
            self._comb_explicit_rhs = right_hand_side

        # Set the remainder of the inputs as instance attributes
        if alg_con is not None and coordinate_derivatives is not None:
            alg_con = [i + len(coordinate_derivatives) for i in alg_con]
        self._alg_con = alg_con
        self.output_eqns = output_eqns

        # Change the body and loads iterables to tuples if they are not tuples
        # already
开发者ID:gorisaka,项目名称:sympy,代码行数:70,代码来源:system.py

示例3: buchMol

# 需要导入模块: from sympy import Matrix [as 别名]
# 或者: from sympy.Matrix import col_join [as 别名]
def buchMol(points, ordering, weightVector=(1, 1, 1)):
    """
	Given X = [(c11,c12,...,c1n),...,(cs1,cs2,...,csn)] affine point set
	and ordering 'lex','grlex','grevlex', or 'weighted' (plus a weight vector)
	computes reduced Groebner basis and Q-basis of the ring mod the ideal
	"""
    from sympy import symbols, Poly, div, Rational, Matrix
    from newLT import monomialOrdering

    dim = len(points[0])
    for pt in points:  # check that all pts have same dimension
        assert len(pt) == dim
    if dim in [1, 2, 3]:
        l = ["x", "x,y", "x,y,z"]
        varlist = symbols(l[dim - 1])
    else:
        varstring = "x0"
        for i in xrange(1, dim):
            varstring += ",x" + str(i)
        varlist = symbols(varstring)
    monClass = monomialOrdering(varlist, ordering, weightVector)
    counter = 0  # keep track of number of rows of matrix & size of S
    G, normalSet, S = [], [], []
    L = [Poly(1, varlist, domain="QQ")]
    M = Matrix(0, len(points), [])
    pivots = {}  # {column:row}
    while L != []:
        # step 2:
        t = L[0]
        for elmt in L:
            if monClass.compare(t.as_dict().keys()[0], elmt.as_dict().keys()[0]):
                t = elmt
        L.remove(t)
        evalVector = Matrix(1, len(points), [t.eval(pt) for pt in points])
        print "hi"
        print M
        print evalVector
        v, a = vecReduce(evalVector, M, pivots)
        print v
        viszero = False
        if firstNonzero(v) == -1:
            viszero = True
        toAdd = t
        for i in xrange(counter):
            toAdd += Poly(-1, varlist) * Poly(a[i], varlist) * S[i]
        if viszero:
            G.append(toAdd)
            for mon in L:
                if div(t, mon)[1] == 0:
                    L.remove(mon)
        else:
            pivSpot = firstNonzero(v)
            pivots[pivSpot] = M.shape[0]
            M = M.col_join(v)
            S.append(toAdd)
            counter += 1
            normalSet.append(t)
            for variable in varlist:
                toCheck = Poly(variable, varlist) * t
                isMultiple = False
                for elmt in L:
                    if div(elmt, toCheck)[1] == 0:
                        isMultiple = True
                        break
                if isMultiple:
                    continue
                for elmt in G:
                    if div(monClass.LT(elmt), toCheck)[1] == 0:
                        isMultiple = True
                        break
                if isMultiple == False:
                    L.append(toCheck)
    return G, normalSet
开发者ID:nbliss,项目名称:polyDiv,代码行数:75,代码来源:buchberger-moller.py


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