Group Abstract Group Abstract

Message Boards Message Boards

0
|
1K Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Machine precision and working precision in NonlinearModelFit

Posted 3 months ago
POSTED BY: Rajesh Chell
2 Replies

Some functions treat arbitrary-precision numbers as above machine-precision numbers. They are different kinds of numbers. Exact numbers are above arbitrary-precision and machine-precision numbers. See the Numbers tech note for further discussion. So if in NonlinearModelFit[], you set WorkingPrecision to any positive numeric expression other than the symbol MachinePrecision and your data or model have machine-precision numbers in them, a warning message will be printed. It is a warning only. NonlinearModelFit[] will convert the inputs to the appropriate precision. But if the inputs are of lower precision than the desired output, a warning seems appropriate.

(1a) One way to deal with it is to ignore it. (1b) This also ignores it and keeps the warning from being printed: Quiet[NonlinearModelFit[...], NonlinearModelFit::precw].

(2) Another way is to artificially raise the precision of the inputs. Jim Baldwin's suggestion, Rationalize[..., 0], converts the numbers to exactly rational numbers. SetPrecision[stuff, 6] would set the argument stuff to have a Precision of 6.

(3) You may have a reason for using WorkingPrecision -> 6 (round-off error tracking, for instance, except...†), but in most cases I've encountered, PrecisionGoal -> 3 and machine precision is faster and just as good.

†Note: Using a number for WorkingPrecision does not guarantee error-tracking. Error-tracking in arbitrary-precision numbers can be overridden with $MinPrecision and $MaxPrecision. I'm not sure what NonlinearModelFit[] does.

POSTED BY: Michael Rogers
Posted 3 months ago

A minimal working example will get you more specific help.

But, in general, rationalizing your data will get rid of that warning. In other words, use Rationalize[data,0] prior to using NonlinearModelFit.

POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard