I am wondering if it is possible to get the correct numerical result without computing with a lot of precisions in expressions.
as a simple example suppose in the middle of some of my numerical code there is something like:
Log[1 +3 E^-10000] /E^-10000
The obvious fact is that the expression is just "3". But because the computation is numeric if I want to get the correct result I had to evaluate the expression with a precision of 10000! For example with N[#,10000]&.
And then the result is something like:
2.99999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999
And I don't need that much precision and want to get the result much easier than computing each part of the expression (here the numerator and denominator to a high degree of precision 1000). I just want it to be about 3. looking at the expression Log[1 +3 E^-10000] /E^-10000, it is obvious that it is 3. But what Mathematica has to do to get this result is that it should evaluate both the numerator and denominator to a high degree of precision. Isn't it possible for Mathematica to do some symbolic numerical examination of expressions before evaluating them numerically? My problem is that in my problem (due to the appearance of such quantities) I did not know how much set the precision. and then also a there is a problem with the time needed for high-precision evaluation. Suppose the expression appear in a sum like this:
Sum[Log[1 + 3 E^-n]/E^-n, {n, 0, 1000}] //N
Evaluating that without enough precision did not lead to the correct result. The sum after about 5 terms is ~ 3 for each term. They have a finite contribution to the sum. On the other hand, the first terms in the sums differ from 3.
I symbolic computation we know:
Series[Log[1 + 3 x]/x, {x, 0, 1}]
(* 3 - 9x/2 + O[x]^2 *)
But in the numeric case, is there possible to write a function that examines each part of an expression and threat numbers smaller than some \epsilon in a manner similar to the above symbolic result?
I hope, I have made my question clear. I would be grateful If anyone could help with that.
Thanks in advance.
Block[{$MaxExtraPrecision = 5000}, Floor[Log[1 + 3 E^-10000]/E^-10000, 2 $MachineEpsilon]]
Not sure how to automate beyond the example, though. $\endgroup$PossibleZeroQ[Log[1 + 3 E^-10000]/E^-10000 - 3]
which evaluates toFalse
$\endgroup$