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.
add fu to simplify
fix doctests and order terms
shut of 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