Mathematica: dealing with significant figures

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 5K views
yourgoldteeth
Messages
9
Reaction score
0
Hi everyone.

Hopefully this is easy to solve.

I have large amounts of mined data that have differing levels of precision. I want to do analysis of:

1) number of decimal places present
2) significant figure error intervals based on the precision (for instance, 0.003 could have been rounded from 0.0025 to 0.0035)

I can't find a clean way to do it in Mathematica, as importing my data makes it all 'MachinePrecision' and it thinks everything has 15.9456 digits of precision.

I've tried back doors, such as doing a StringLength[ToString[x]] but even that doesn't work for very small decimals, as it introduces scientific notation which throws everything off.

Any ideas?
 
Physics news on Phys.org
Hurkyl said:
Have you looked at the Interval function?

The interval function does not appear to be what I am looking for. I have a single value, and need to specify a range based on significant figures rules for that one value. The interval function requires a range as input.
 
I would just force them all to be scientific notation, that way you know the precision. You can pluck out the precision pretty easy.

j = { .00000000000000000001,.00000000000000000000000001.,.0000000000000001}

NumberForm[j, NumberFormat->(#3&)]

Now you have a list of precisions. You can feed those into the interval range function, and just put your error ranges on in front of the exponent.

There is probably a better way, but this probably solves it.. that way you don't have to force variable precision, which will slow down your calculations.
 
This one

ScientificForm[j, NumberFormat -> (#3 &)]