Factors accepts Expr; as_powers_dict returns int-based defaultdict

`as_powers_dict` didn't play nicely with Factors because for Mul,
a list-based defaultdict was returned. It now returns an int-based
one like Add does.

Docstrings for exprtools Factors were added.

distinguish between 0 and 1 factors

make repr canonical
add fu to simplify
fix doctests and order terms
shut off trigsimp when using fu

simplify in TR0 calls trigsimp; if fu is being used then calls
to trigsimp if there are trig functions are shut off.  This is
not the best thing (since if there is a single hyperbolic in the
expression, the call to trigsimp will still be made).

Also, I'm not sure what best simplifications are needed in TR0;
the original paper should be consulted.

These are some expressions that aren't simplified as they might
be in the Fu:

    def trigsimp(e, **kw):
        return fu(e)
    a, x, y = symbols('a x y')
    assert trigsimp(diff(integrate(cos(x)/sin(x)**7, x), x)) == \
           cos(x)/sin(x)**7
    assert trigsimp(sin(2)*sin(3) + cos(2)*cos(3) + cos(2)) == cos(1) + cos(2)
    eq = cos(2)*(cos(3) + 1)**2/(cos(3) - 1)**2
    # use exclusion
    assert trigsimp(eq) == eq
    # but not unnecessarily
    assert trigsimp(cos(2)*(cos(3) + 1)**2*(cos(3) - 1)**2) == \
        cos(2)*sin(3)**4
    assert trigsimp(1/sin(x)**2 - 1) == \
        cot(x)**2 \
        # not tan(x)**-2
    assert trigsimp(tanh(x + y) - tanh(x)/(1 + tanh(x)*tanh(y))) == \
        tanh(y)/(tanh(x)*tanh(y) + 1) \
        # not tanh(y)*tanh(x + y)/(tanh(x) + tanh(y))
    assert trigsimp(tan(2)**2*cos(3)*exp(2)*cos(2)**2) == \
        sin(2)**2*cos(3)*exp(2) \
        # not 4*exp(2)*sin(1)**2*cos(1)**2*cos(3)
    assert trigsimp(cot(2)*cos(3)*exp(2)*sin(2)) == \
        cos(3)*exp(2)*cos(2) \
        # not exp(2)*cos(1)**2*cos(3) - exp(2)*sin(1)**2*cos(3)
    assert trigsimp(tan(2)*cos(3)*exp(2)/sin(2)) == \
        cos(3)*exp(2)/cos(2) \
        # not exp(2)*cos(3)/(-sin(1)**2 + cos(1)**2)
    assert trigsimp(cot(2)*cos(3)*exp(2)/cos(2)) == \
        cos(3)*exp(2)/sin(2) \
        # not exp(2)*cos(3)/(2*sin(1)*cos(1))

Note that the last expression passes if the numbers are replaced with
symbols, so it could be that one of the simplification functions in
TR0 is to blame -- I am not aware of any special bias against numbers
in the other simplification routines.
do not process Number args

If one wants to process Number args, e.g. to change cos(2) into
an expression involving arguments of 1, then all number args
can be multiplied by a Dummy which, after simplification, is
replaced with 1.

>>> fu(cos(2))
cos(2)
>>> fu(cos(2*Dummy()))
2*cos(_15)**2 - 1
>>> _.subs(_.atoms(Dummy()).pop(), 1)
-1 + 2*cos(1)**2

Of course one would have to exclude any Dummies that were already
present before introducing the new Dummies. A replacement function
could be something like

deftoms(C.TrigonometricFunction)
    d = []
    r = {}
    dum = {}
    for ti in t:
        a = ti.args[0]
        if a.is_Number:
            if ti not in r:
                u = Dummy()
                r[ti] = ti.func(u*a)
                dum[u] = S.One
    return eq.xreplace(r), dum

>>> eq = Dummy() + cos(2)
>>> eq, d = num2mul(eq)
>>> TR11(eq).subs(d)
_21 - sin(1)**2 + cos(1)**2

This may not make a change when fu() is applied
unless it leads to a shorter expression:

>>> fu(eq)
_21 + cos(2*_22)
add TR8 after RL2

This allows a product of functions to simplify to a sum
if that is simpler, e.g. 2*cos(1/2)*cos(3/2) -> cos(1) + cos(2)
import fu and FU

FU is a dictionary mapping strings to the corresponding
fu.py functions:

FU['TR0'](x) -> x
fu upgrades

xreplace does top-down replacements so replacing Adds with 1
would give 1 for the following rather than 0

	(x - x*(y + 1))

if replace acts on the arg of a function it doesn't also
act on the function, so replacing tan with sin/cos changes
tan(tan(x)) to tan(sin(x)/cos(x)) but does not change the outer
tan.

For the above two reasons, a custom bottom-up traversal of
expressions is used for most fu routines.

==========

correct TR8 rule and use recursion in TR8 if new products
were introduced.

TR9 and TR10i have a custom matching routine that sorts
arguments by coefficient (and then perhaps by free symbols)
to help prune the possible pairs to consider for combination
down to a smaller subset. The is informed by the work of Mario
Pernici whose TR10_inv was the one against modifications were
tested.

===========

function docstrings and a module docstring were edited.

The simplify_utils of Mario's is here though that could be
removed (and it contains things like random_expr that could
probably be removed or made into private functions).

=========

To avoid recursion errors, when fu is being used, calls to
fu are suppressed by passing fu=False to simplify from TR0.

TR10i or TR10_inv (now in use) can be used in trigsimp.
L returns Integer; fix typo
add is_zero and is_one properties to Factors
fix doctest error in trigsimp