(tokens, local_dict, global_dict)
return result
Implicitly adds '*' tokens.

    Cases:

    - Two AppliedFunctions next to each other ("sin(x)cos(x)")

    - AppliedFunction next to an open parenthesis ("sin x (cos x + 1)")

    - A close parenthesis next to an AppliedFunction ("(x+2)sin x")\

    - A close parenthesis next to an open parenthesis ("(x+2)(x+3)")

    - AppliedFunction next to an implicitly applied function ("sin(x)cos x")
Implicitly adds '*' tokens.
Implicitly adds * tokens .
def _implicit_multiplication(tokens, local_dict, global_dict):
    """Implicitly adds '*' tokens.

    Cases:

    - Two AppliedFunctions next to each other ("sin(x)cos(x)")

    - AppliedFunction next to an open parenthesis ("sin x (cos x + 1)")

    - A close parenthesis next to an AppliedFunction ("(x+2)sin x")\

    - A close parenthesis next to an open parenthesis ("(x+2)(x+3)")

    - AppliedFunction next to an implicitly applied function ("sin(x)cos x")

    """
    result = []
    for tok, nextTok in zip(tokens, tokens[1:]):
        result.append(tok)
        if (isinstance(tok, AppliedFunction) and
              isinstance(nextTok, AppliedFunction)):
            result.append((OP, '*'))
        elif (isinstance(tok, AppliedFunction) and
              nextTok[0] == OP and nextTok[1] == '('):
            # Applied function followed by an open parenthesis
            result.append((OP, '*'))
        elif (tok[0] == OP and tok[1] == ')' and
              isinstance(nextTok, AppliedFunction)):
            # Close parenthesis followed by an applied function
            result.append((OP, '*'))
        elif (tok[0] == OP and tok[1] == ')' and
              nextTok[0] == NAME):
            # Close parenthesis followed by an implicitly applied function
            result.append((OP, '*'))
        elif (tok[0] == nextTok[0] == OP
              and tok[1] == ')' and nextTok[1] == '('):
            # Close parenthesis followed by an open parenthesis
            result.append((OP, '*'))
        elif (isinstance(tok, AppliedFunction) and nextTok[0] == NAME):
            # Applied function followed by implicitly applied function
            result.append((OP, '*'))
        elif (tok[0] == NAME and
              not _token_callable(tok, local_dict, global_dict) and
              nextTok[0] == OP and nextTok[1] == '('):
            # Constant followed by parenthesis
            result.append((OP, '*'))
        elif (tok[0] == NAME and
              not _token_callable(tok, local_dict, global_dict) and
              nextTok[0] == NAME and
              not _token_callable(nextTok, local_dict, global_dict)):
            # Constant followed by constant
            result.append((OP, '*'))
        elif (tok[0] == NAME and
              not _token_callable(tok, local_dict, global_dict) and
              (isinstance(nextTok, AppliedFunction) or nextTok[0] == NAME)):
            # Constant followed by (implicitly applied) function
            result.append((OP, '*'))
    if tokens:
        result.append(tokens[-1])
    return result
def _implicit_multiplication ( tokens , local_dict , global_dict ) : result = [ ] for tok , nextTok in zip ( tokens , tokens [ 1 : ] ) : result . append ( tok ) if ( isinstance ( tok , AppliedFunction ) and isinstance ( nextTok , AppliedFunction ) ) : result . append ( ( OP , '*' ) ) elif ( isinstance ( tok , AppliedFunction ) and nextTok [ 0 ] == OP and nextTok [ 1 ] == '(' ) : # Applied function followed by an open parenthesis result . append ( ( OP , '*' ) ) elif ( tok [ 0 ] == OP and tok [ 1 ] == ')' and isinstance ( nextTok , AppliedFunction ) ) : # Close parenthesis followed by an applied function result . append ( ( OP , '*' ) ) elif ( tok [ 0 ] == OP and tok [ 1 ] == ')' and nextTok [ 0 ] == NAME ) : # Close parenthesis followed by an implicitly applied function result . append ( ( OP , '*' ) ) elif ( tok [ 0 ] == nextTok [ 0 ] == OP and tok [ 1 ] == ')' and nextTok [ 1 ] == '(' ) : # Close parenthesis followed by an open parenthesis result . append ( ( OP , '*' ) ) elif ( isinstance ( tok , AppliedFunction ) and nextTok [ 0 ] == NAME ) : # Applied function followed by implicitly applied function result . append ( ( OP , '*' ) ) elif ( tok [ 0 ] == NAME and not _token_callable ( tok , local_dict , global_dict ) and nextTok [ 0 ] == OP and nextTok [ 1 ] == '(' ) : # Constant followed by parenthesis result . append ( ( OP , '*' ) ) elif ( tok [ 0 ] == NAME and not _token_callable ( tok , local_dict , global_dict ) and nextTok [ 0 ] == NAME and not _token_callable ( nextTok , local_dict , global_dict ) ) : # Constant followed by constant result . append ( ( OP , '*' ) ) elif ( tok [ 0 ] == NAME and not _token_callable ( tok , local_dict , global_dict ) and ( isinstance ( nextTok , AppliedFunction ) or nextTok [ 0 ] == NAME ) ) : # Constant followed by (implicitly applied) function result . append ( ( OP , '*' ) ) if tokens : result . append ( tokens [ - 1 ] ) return result