0
$\begingroup$

I'd like to return the precision of the first non zero digit in a number. The motivation is so that I can quickly construct my error notation which is the bracketed notation, e.g. $x = 1.234$ with associated error $\delta x = 0.0015$ I would represent the measurement as $1.23(2)$. I want to automate this so I would:

  • Determine the precision of the error -- round up by the next digit. So in pseudo code:

    DeltaX = 0.0015 DeterminePrecissionValue[DeltaX] (*Would return: 3*) NumberForm[Numb, {DeltaX, 3}] NumberForm[Numb, {X, 3}]

  • Based on the above result I would then round the measurement value to the precision of the error result and then format accordingly.

$\endgroup$
  • 3
    $\begingroup$ That precision can be obtained using the base 10 log, e.g. In[72]:= Ceiling[-Log[10, .0015]] Out[72]= 3 $\endgroup$ – Daniel Lichtblau Dec 30 '18 at 17:24
  • $\begingroup$ Elementary mathematics comes to the rescue again. Thanks @DanielLichtblau! $\endgroup$ – Q.P. Dec 30 '18 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.