Re: BesselZeros and Working Precision?
- To: mathgroup at smc.vnet.net
- Subject: [mg33861] Re: [mg33841] BesselZeros and Working Precision?
- From: David Withoff <withoff at wolfram.com>
- Date: Sat, 20 Apr 2002 02:49:53 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
> I'm puzzled by why the four alternative forms > > BesselJZeros[0, 1][[1]] > > N[ BesselJZeros[0, 1][[1]], 12] > > BesselJZeros[0, 1, WorkingPrecision ->12][[1]] > > N[ BesselJZeros[0, 1, WorkingPrecision ->12][[1]], 12] > > all give the same 6-digit answer, namely 2.40483 All of these results are machine numbers (roughly 16 digits). Machine numbers display with six digits by default, and since the first six digits of these results are all the same, the digits that are shown by default are all the same. The N function has no effect in these examples. The first two results are identical, and the last two results are identical. The first two results differ from the last two results beause of the settings of the WorkingPrecision option. N[expr, 12] does not convert the machine number to a variable-precision number so that it can throw away the last four digits. It just returns the original machine number. If you really want to throw away the last four digits of the 16-digit machine numbers to get 12-digit number, you can use SetPrecision to do that. The WorkingPrecision option specifies the precision that will be used for internal calculations. It does not, at least not directly, specify anything about the precision of the result. Since the AccuracyGoal option has been left at the default AccuracyGoal -> Automatic, the accuracy goal is set to six digits less than the setting of the WorkingPrecision option. This is how essentially all standard Mathematica numerical functions are designed. If the tolerance options are set to Automatic, those tolerances are set six to ten digits less than the working precision. With the working precision reduced below the default WorkingPrecision -> 16, the accuracy goal is also reduced, so the results with WorkingPrecision -> 12 will have less accuracy than the default, but they still have six digits of accuracy, so the six digits displayed will be the same. > I'm also *really* puzzled by why > > BesselJZeros[0, 1, WorkingPrecision -> 6][[1]] > > gives the *one*-digit answer "0". Setting WorkingPrecision -> 6 and leaving AccuracyGoal -> Automatic gives an accuracy of zero (six digits less than the working precision), so you get a result with an accuracy of zero. > Actually, here's a table of BesselJZeros[0, 1, WorkingPrecision -> k][[1]] for > k from 1 to 30. Note erroneous answers at k = 7 and 8 also. > > {"1", "0"}, > {"2", "0"}, > {"3", "0"}, > {"4", "0"}, > {"5", "0"}, > {"6", "0"}, > {"7", "2.398095666212098`"}, > {"8", "2.404944945798332`"}, > {"9", "2.404825723910026`"}, The result at k=7 (WorkingPrecision) corresponds to AccuracyGoal->1, and the result at k=8 corresponds to AccuracyGoal -> 2. Both of those results meet the specified accuracy goals, as do the remaining results in the table. It would be reasonable to suggest that BesselJZeros[0, 1, WorkingPrecision -> 6] should simply have abandoned the calculation, for consistency with In[1]:= BesselJZeros[0, 1, AccuracyGoal -> 0] Out[1]= BesselJZeros[0,1,AccuracyGoal -> 0] since that is effectively what BesselJZeros[0, 1, WorkingPrecision -> 6] is specifying. Dave Withoff Wolfram Research