コード例 #1
0
    def doit(self):
        args, indices, free, dum = TensMul._tensMul_contract_indices(self.args)

        obj = self.func(*args)
        obj._indices = indices
        obj._free = free
        obj._dum = dum
        return obj
コード例 #2
0
ファイル: toperators.py プロジェクト: asmeurer/sympy
    def doit(self):
        args, indices, free, dum = TensMul._tensMul_contract_indices(self.args)

        obj = self.func(*args)
        obj._indices = indices
        obj._free = free
        obj._dum = dum
        return obj
コード例 #3
0
ファイル: toperators.py プロジェクト: shubhsherl/sympy
    def _contract_indices_for_derivative(cls, expr, variables):
        variables_opposite_valence = []
        for i in variables:
            i_free_indices = i.get_free_indices()
            variables_opposite_valence.append(
                i.xreplace({k: -k
                            for k in i_free_indices}))

        args, indices, free, dum = TensMul._tensMul_contract_indices(
            [expr] + variables_opposite_valence, replace_indices=True)

        for i in range(1, len(args)):
            i_indices = args[i].get_free_indices()
            args[i] = args[i].xreplace({k: -k for k in i_indices})

        return args, indices, free, dum
コード例 #4
0
    def __new__(cls, expr, *variables):

        # Flatten:
        if isinstance(expr, PartialDerivative):
            variables = expr.variables + variables
            expr = expr.expr

        # TODO: check that all variables have rank 1.

        args, indices, free, dum = TensMul._tensMul_contract_indices(
            [expr] + list(variables), replace_indices=True)

        obj = TensExpr.__new__(cls, *args)

        obj._indices = indices
        obj._free = free
        obj._dum = dum
        return obj
コード例 #5
0
ファイル: toperators.py プロジェクト: asmeurer/sympy
    def __new__(cls, expr, *variables):

        # Flatten:
        if isinstance(expr, PartialDerivative):
            variables = expr.variables + variables
            expr = expr.expr

        # TODO: check that all variables have rank 1.

        args, indices, free, dum = TensMul._tensMul_contract_indices([expr] +
            list(variables), replace_indices=True)

        obj = TensExpr.__new__(cls, *args)

        obj._indices = indices
        obj._free = free
        obj._dum = dum
        return obj