# WorkingPrecision Default

Posted 8 years ago
7847 Views
|
3 Replies
|
0 Total Likes
|
 I have read in a book that the control WorkingPrecision default is 16. Nevertheless when I have used the FindRoot  command as showed below with WorkingPrecision ->16 and without WorkingPrecision control I found different answers. I would like to know why. In:= FindRoot[Cos[100/x]==x/(x+1),{x,5000}]    Out= {x->5000.83}            In:= FindRoot[Cos[100/x]==x/(x+1),{x,5000}, WorkingPrecision->16]    Out= {x->5000.833191159525}Thank You,Ana Answer
3 Replies
Sort By:
Posted 8 years ago
 You're actually running into a number of items. First, Mathematica's default display setting shows 6 digits of precision. You can edit this by going to Edit->Preferences and then selecting the Advanced tab, then hitting the Option Inspector button. In the window that pops up, type precision. You can then edit the PrintPrecision directly. This is not, however, the underlying precision:In:= FullForm[FindRoot[Cos[100/x]==x/(x+1),{x,5000}]]Out//FullForm= List[Rule[x,5000.833191160513]]Here you see that 16 digits of numerical precision are underlying the result. However, you must also realize that those may not be real digits of precision. That is, when 16 digits determine the round-off location, the error can grow during the calculation.  Now let's look at the FullForm of your second calculation:In:= FullForm[FindRoot[Cos[100/x]==x/(x+1),{x,5000},WorkingPrecision->16]]Out//FullForm= List[Rule[x,5000.8331911595252830652746962313621464204516.]]Here, far more digits are kept but the result ends in `16, meaning Mathematica only trusts the first 16 digits of precision. Answer
Posted 8 years ago
 The default precision is what the computer uses for 64-bit floating-point arithmetic. That turns out to be just UNDER 16 digits, because the precision is set by the number of bits in the number, not a number of base-10 digits. In:= $MachinePrecision Out= 15.9546In:= N[Pi,16] Out= 3.141592653589793When you specify 16 digits for working precision, you tell FindRoot to use the high-precision mechanism for calculations. 16 digits was the standard number for$MachinePrecision many years ago. The book might be from that era, or is approximating. Answer
Posted 14 days ago
 I now know how find up to as many roots as I need to any precision I want. Instead of Reduce I have used SetPrecsion with NSolve however it will only solve 64 roots at a time with precision 30 so I have set up six NSolve lines and used the Join function to combine all the roots into one list each element with precision 30.After a lot of trial and error I was actually able to use these roots in a generic trigonometric series.There has to be an easier way. It's awkward to use. Again I've looked through the documentation and came up empty. My answer is in the attached Notebook.I'm an oldtimer and had an easier time with Fortran with all due respect. Attachments: Answer