def renameDummyIndex(exp):
    'renames all Dummy indecis in the expression, in a clever way'
    tl=lists.makeTermList(exp)
    ttl=lists.makeTensorTermList(tl)
    lists.sortTensorTermList(ttl)
    renameDummyIndex_TensorTermList(ttl)
    return lists.rebuildAdd(ttl,tl)
def tensorSimplify(exp, **kw):
    '''
    Tyres to simplify a tensor expresion by writing it on a normal form
    If you do not like the result you can try simplifying by had using
    e.g subsIndex, contractDeltas, renameDummyIndex, epsAsDeltas, allEpsAsDeltas
    '''
    termList = delta.contractDeltas_termList(
                    lists.makeTermList(
                        sympy.expand(
                            eps.epsAsDeltas(exp,**kw) ) ),
                    **kw)
    ttl = lists.makeTensorTermList(termList)
    lists.sortTensorTermList(ttl)
    renameDummyIndex_TensorTermList(ttl)
    return lists.rebuildAdd(ttl, termList)
Beispiel #3
0
def findIndex(exp):
    '''
    Finds all indecis in exp. Returns a dictionary with all idecis found.

    'free': All free indecis, 
            (not to be summed over acording to sumation convention)
    'dummy': All dummy indecis, 
             (too to be summed over acording to sumation convention)
    'tooManny': Indecis that are found to many times, 
                (i.e. more than twise in the same term if index is dummy, 
                 and more than once in the same term if index is free)
    'missingFree': Free indecis that are missing in one or more term.
    'other': indecis that are not of type sympy.Dummy or sympy.Symbol
    '''
    return findIndex_TensorTermList(
        lists.makeTensorTermList(
            lists.makeTermList(exp)))