Re: Why Mathematica does not issue a warning when the calculations
- To: mathgroup at smc.vnet.net
- Subject: [mg117797] Re: Why Mathematica does not issue a warning when the calculations
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Thu, 31 Mar 2011 04:05:13 -0500 (EST)
Richard Fateman wrote: > On 3/30/2011 9:48 AM, Daniel Lichtblau wrote: >> >> Could do >> >> $MinPrecision = 20; >> $MaxPrecision = 20; >> >> Not the most intuitive way to go about things. But it should have the >> desired effect of a putative $DefaultArithmetic = Precision[20] > I kind of assume that other programs secretly change the binding of > these, e.g. NSolve. Yes. > That could be a good thing or not. For example, > > $MaxPrecision > $MinPrecision > > f[x_]:= WhateverToBeComputedInPrecision20[x] > > and then you call NSolve[f[x]==0,x] , > > NSolve requests a precision of 150 for evaluating f, (although it seems > the request is refused!). Yes. it is an example of the sort I mentioned wherein Mathematica will artificially raise precision. The justification (though not the reason) is we can claim to be solving a "nearby" problem. > Consequently it is not so clear how this might work. Do you want your > precision settings for your functions to break NSolve? No, I do not especially want that. Though indeed they probably will break it, since I think NSolve will not override the $MaxPrecision or the effective using of fixed precision. I'm not going to lose sleep over this one. If someone wants fixed precision, they should not be calling NSolve in the middle. And if they don't know that? Tough luck, I guess. I think there will come a day when NSolve will be able to work in fixed precision. But I imagine the problem might still be around, for other functions. That is to say, I am not certain NSolve is the only offender in absolutely requiring significance arithmetic in order to function. > Here's a way around this issue, I think. For every function of > interest, do something like this: > prec; > f[x_]:=Block[ {$MaxPrecision=prec,$MinPrecision=prec}, Whatever...] > > This is even less intuitive than your suggestion. > > > RJF People do this, exactly to avoid the precision degradation of your original example. By which I mean "original to this thread". And also "original to your litany of Mathematica issues", since you raised the same example maybe 20 or so years ago. Daniel Lichtblau Wolfram Research