3533: nfloat fix

A proper evaluation of an expression cannot be done by substituting
evaluated numbers into the expression as a result of precision issues.
Instead, numbers must be evaluated in groups, e.g. (sqrt(3) - sqrt(2)).n()
rather than sqrt(3).n() - sqrt(2).n(). Often this doesn't matter much,
but as the added test shows, it does matter.

evalf needs a serious overhaul to make this right, too, since if evalf
(instead of nfloat) is used on the added expression for this issue, the
same mistake occurs. This is because _matches_commutative deals with
args arg-wise (instead of in lumped args which are all numbers).

The way evalf should work, I believe, is:

1) expr.evalf()
  a) expr.is_number is False
    i) if subs given, then do the subs thing in evalf
    ii) else call to expr._eval_evalf (with n, not prec) to find the
       numbers and pass them back to evalf and replace them in the
       expr; if there is not expr._eval_evalf routine use the Mixin
       routine, changed to apply evalf to each of the args (rather
       than returning None as now).
  b) normal evalf when expr.is_number
3533: fix for Add/Mul evalf
simpler 3533 nfloat fix
use _aresame in xreplace test of equality

It is possible that A === B even though A and B are not structurally the
same, so the more strict _aresame() is used to test for exact equality.
remove more references to Float(nan)
solve implicitly for anything except numbers

There is no reason to disallow solution of an equation for
a given object, so it is possible to isolate objects which are
not symbols as long as they are not numbers -- numbers should only
be themselves, so there should be nothing to solve for. Functions
like cos(1) are numbers and so are undefined functions like f(1)
but the latter are allowed since they don't evaluate to a number.
supply non-numeric objects as symbols if necessary
add note about implicit solving

Although solving for numbers 1, cos(1 + sqrt(2)) could be added,
this has not been added at this time. To do this, the user will
have to handle the substitution on their own.

Part of the reason this was avoided was because if expressions
are given that are themselves numbers, then trying to rearrange
for a number in that expression can only be done if the expression
itself is 0 -- if it's not then any inferences made from it are
invalid.  One has to watch for -1 that is hiding in all subtractions, too.

e.g. if eqs = Tuple(4 - sqrt(2), sqrt(2)/3 + 1)
>>> eqs = Tuple(4 - sqrt(2), sqrt(2)/3 + 1)
>>> eqs.subs([(1,a),(4,b)])
(-sqrt(2)*a + b, a + sqrt(2)/3)
>>> solve(_)
{b: -2/3, a: -sqrt(2)/3}

but compare to the solution after masing off the -1

>>> solve(eqs.subs(-1, Symbol('-1')).subs([(1,a),(4,b)]), a, b)
{b: -sqrt(2)*-1, a: sqrt(2)/(3*-1)}
>>> Dict(_).subs(Symbol('-1'), -1)
{a: -sqrt(2)/3, b: sqrt(2)}
use / instead of // for integers
look at exponent rather than computing int
Float accepts mpf and watches for exponential notation when prec=''

The significant figures should not include zeros that were signified
with the exponent as in '12e3' -- this gives 1.2e4 rather than 12000.

Also, don't count the negative when counting significant figures.
3540: don't base nonzero on man of mpf tuple

It is necessary but not sufficient to guarantee that the tuple represents
0 -- finf, for example, also has a mantissa of 0.
remove more references to fnan; use is_zero and is_positive

In the context of Number, where the sign is easily determined,
the use of is_zero is much faster than using an equality test
or converting to a boolean:

>>> timeit('bool(z)','from sympy import Float\nz=Float(0)')
1.1109158992767334
>>> timeit('z==0','from sympy import Float\nz=Float(0)')
10.78619384765625
>>> timeit('z.is_zero','from sympy import Float\nz=Float(0)')
0.10547804832458496

>>> timeit('bool(z)','from sympy import Rational\nz=Rational(1,3)')
0.3191959857940674
>>> timeit('z==0','from sympy import Rational\nz=Rational(1,3)')
5.848392963409424
>>> timeit('z.is_zero','from sympy import Rational\nz=Rational(1,3)')
0.10593008995056152
2950: Rational processes Float and float

o The unprejudiced underlying fraction of the float is used to
create the Rational. Since as_integer_ratio() is not available in 2.5
(and Decimal in 2.5 will not take a float) mpf is used to parse the
float to get the mantissa and exponent.

o strings matching a literal 'float/float' are now processed and
processing is not passed to sympify (which makes Rational more literal).

        It makes sense to handle strings representing Rationals since
        it is about 100x faster than passing off the expression to
        sympify. No deeper processing is done, however.
Merge pull request #1679 from smichr/3533

3533
add coverage tests for oo and others; us is_nonnegative
solve can solve for any expression -- no checking
Updated link to SymPy development wiki
Dropped dead link to J.C. Faugere's lecture notes.
Changed to HTML entity codes for wikipedia reference, since closing
parenthesis was not parsed properly by linkcheck.