On 5/9/2013 3:40 PM, acer wrote:
>
> Could you please show (using that forward-tick ` notation, or otherwise) how
>to get Mathematica 9 or current WolframAlpha to produce 100 correct decimal
>digits of Gamma[10^6 + 1/2, (1003/1000)*10^6] without having to temporarily
>bump working precision to some arbitrary value higher than 100?
>
Because integers have infinite accuracy, N[computation_wit_integers,n]
will always(*) manage to get the required n precision:
http://reference.wolfram.com/mathematica/tutorial/ArbitraryPrecisionNumbers.html
"If you start with an expression that contains only integers
and other exact numeric quantities, then N[expr, n] will
in almost all cases succeed in giving you a result to n digits
of precision. You should realize, however, that to do this
Mathematica sometimes has to perform internal intermediate
calculations to much higher precision. The global variable
$MaxExtraPrecision specifies how many additional digits
should be allowed in such intermediate calculations. "
But If you want to use floating points instead of integers, then
one needs to tell M the digits of precision of each explicitly.
Gamma[10^6 + 0.5`21, 1.003`21*10^6]
1.12717938591210247577*10^5565703
1.1271793859121025251 <---- your value
Precision[%]
20.699
> I don't see where you have shown that explicitly, though you seem to be implying
>that it's straightforwardly possible.
>
> For example, what simple modification of syntax to,
> N[Gamma[10^6 + 1/2, (1003/1000)*10^6], 20]
> would needed in order to obtain 20 (and only 20) correct decimal
> digits of a floating-point approximation?
>
If you do not want to use exact values for input, but want to
use floating points in the input, then I do not know other than
using `nn. In the above for example, using `21 gave
atleast the 20 digits precision in the output.
From above link:
" Mathematica tries to give you results which have the
highest possible precision, given the precision of the
input you provided. "
"The precision of the output from a function can depend in
a complicated way on the precision of the input."
"If you give input only to a few digits of precision,
Mathematica cannot give you such high-precision output."
> And what simple modification of syntax to,
> N[Gamma[10^6 + 1/2, (1003/1000)*10^6], 100]
> would be needed in order to obtain 100 (and only 100) correct
>decimal digits of a floating-point approximation?
>
---------------------------
Gamma[10^6 + 0.5`101, 1.003`101*10^6] (*<------ Precision[%] ==> 100.699*)
1.12717938591210252512349905106484944923179280972477237957652285580320\
73065305318232785049213836798160 * 10^5565703
Maple
1.12717938591210252512349905106484944923179280972477237957652285580320\
7306530531823278504921383679652 * 10^5565703
-------------------------
Gamma[10^6 + 0.5`102, 10^6] (*Precision[%]==>100.627*)
4.13251479962262062103065157181206841728923017264300442213705199608773\
37660563466037312873449053610031*10^5565705
Maple 17:
evalf(GAMMA(10^6+1/2,10^6),100);
0.413251479962262062103065157181206841728923017264300442213705199608773\
3766056346603731287344905361003*10^5565706
---------------------------------------------
> In either case, an acceptable syntax should of course *not* require
>any temporary raise to working-precision by a problem-specific amount.
>What's the cleanest and preferably problem independent syntax?
>
> Manually doubling of the working precision, followed by rounding
>down to the requested accuracy, is not ok since (if that were really
>necessary as technique) then there would exist some other example
>which would require trebling the working precision, etc.
>And given an arbitrary problem you wouldn't know how
>high to raise it, a priori. That's the whole point about
>Mathematica's significance arithmetic and error tracking -- that's its automatic.
>
> If there is a straightforward syntax to obtain this clear objective,
>than hopefully someone will share it here.
>
--Nasser