Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to increase the precision globally to 50 at least, but $MinPrecision does not work.

$MinPrecision = 50;
x = Sin[2.]
(* -> 0.909297 *)

Precision[x]
(* -> MachinePrecision *)

How to set the working precision globally, i.e., make all the calculations in the notebook use the new precision?

share|improve this question
1  
Hope this helps, have a look at: mathematica.stackexchange.com/questions/6421/… –  Kardashev3 Dec 1 '13 at 17:15
3  
Precision settings only apply for arbitrary-precision values. When working with machine numbers, there is no tracking or adjustment of precision. So, enter your value as e.g. 2.`16 rather than 2. and you will get the effect you are after. –  Oleksandr R. Dec 1 '13 at 17:27
1  
My notebook involves machine precision numbers in many places; it would be tedious if I do the change like 2.`16 in every place. Is there a convenient way to set the precision once and for all? –  renphysics Dec 1 '13 at 19:03

1 Answer 1

up vote 4 down vote accepted

This looks like a duplicate of my question here Global precision setting . Since I formulated it in a slightly different way, coming from Maple it might however be worth quoting the answer given by Mr. Wizard here. It worked for me in Mathematica 9 if there are no arbitary precision numbers in the notebook (defined as e.g. 2.`16):

$PreRead = (# /. 
 s_String /; 
   StringMatchQ[s, NumberString] && 
    Precision@ToExpression@s == MachinePrecision :> s <> "`50." &);

3/1.5 + Pi/7

Precision[%]

This will act on all later commands before the actual command is executed and set the precision of contained numerical values to 50 digits.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.