Asked by Dias Papas
on 22 Jun 2011

Hi to everyone,

I am dealing with satellite data with accurancy of 25 digits. As I know MATLAB provides computations with maximum 16 digits (long e format). Is there any way to process these data with 25 digits accuracy, because i dont want these values to be rounded?

Thanks a lot

Diamantes

*No products are associated with this question.*

Answer by the cyclist
on 22 Jun 2011

Accepted answer

Do you have the Symbolic Math Toolbox? If so, then:

Fangjun Jiang
on 22 Jun 2011

So, can the Symbolic Math Toolbox be used to read in a long precision data?

Walter Roberson
on 22 Jun 2011

If my memory hasn't slipped a bit: the Maple version of the Symbolic Math Toolbox did not have any file input operations; those were, though, exposed by the Extended Symbolic Math Toolbox.

The MuPad version of the Symbolic Math Toolbox does have file input operations: see http://www.mathworks.com/help/toolbox/mupad/quickref/fileIO.html#fileIO

I do not see there any equivalent of fscanf(). On the other hand, when numbers with large numbers of digits are input, those digits are all preserved... though of course if you then do an arithmetic operation on such a number, the result might be in terms of the current Digits setting.

Answer by Paulo Silva
on 22 Jun 2011

The Symbolic Math Toolbox™ can handle the 25 digits, some of their functions have default digit number of 32 digits.

Fangjun Jiang
on 22 Jun 2011

Help me out here, Paulo! When I type digits in my MATLAB command window, it shows 32. But my example below shows otherwise. Any explaination?

Sean de Wolski
on 22 Jun 2011

@Fangjun

http://www.mathworks.com/matlabcentral/fileexchange/22239-num2strexact-exact-version-of-num2str

might interest you.

Answer by Fangjun Jiang
on 22 Jun 2011

This is a really good question. I like it. Look at the following code:

aStr={'1234567890.12345'; '1234567890.123456'; '1234567890.1234567'; '1234567890.12345678'; '1234567890.123456789'}; aNum=cellfun(@str2double,aStr); aTF=bsxfun(@eq,aNum,aNum') aTF =

1 0 0 0 0 0 1 0 0 0 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1

bStr={'0.123456789012345'; '0.1234567890123456'; '0.12345678901234567'; '0.123456789012345678'; '0.1234567890123456789'}; bNum=cellfun(@str2double,bStr); bTF=bsxfun(@eq,bNum,bNum') bTF =

1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 1 1

Questions:

1. What is the number of precision that MATLAB double can distinguish, 16, 17 or 18? The first example above shows 17, the second shows 18.

2. What to do if need to read more number of precision.

Sean de Wolski
on 22 Jun 2011

I personally find it hard to imagine any measurement system that has an SNR high enough to require anything more than floating point precision.

http://en.wikipedia.org/wiki/Pi#Computation_in_the_computer_age

You need 39 digits of pi to measure the observable universe to within the radius of a hydrogen atom.

Malcolm Lidierth
on 25 Jun 2011

For double precision see http://www.mathworks.com/company/newsletters/news_notes/pdf/Fall96Cleve.pdf

For more digits, you could use java.math.BigDecimal and/or the Apache math BigReals that use them e.g. in MATLAB

java.math.BigDecimal('1').divide(java.math.BigDecimal('3'),10000,java.math.RoundingMode.HALF_EVEN)

Answer by Dias Papas
on 25 Jun 2011

Thanks a lot for your answers. My field, which i use such a number of digits, is satellite orbit determination and gravity field modeling. For example ocean's tide's data are given with 25 digits. Yes, this doesnt mean that all of them are totally useful but they are play their role.

Anyway thanks everyone!

Dias

Jan Simon
on 25 Jun 2011

This is really strange. Heisenberg's uncertainty principle means, that such an adequate position measurement will yield to an enormous impulse. Even a small and light object as the ocean would explode by trying to measure the position with such an accuracy. Of course there can be a reason for such an accuracy, but at least it cannot be physically motivated.

Alexei
on 26 Nov 2014

Pretty sure that's *not* what it means. I'm pretty sure the uncertainty principle means that such an adequate position measurement will yield enormous **uncertainty in what the impulse is**. The impulse could still be really tiny or zero -- but you would have no idea.

Answer by Derek O'Connor
on 25 Jun 2011

Here is a quotation from Prof Nick Trefethen FRS, Oxford:

11. *No physical constants are known to more than around eleven digits, and no truly scientific problem requires computation with much more precision than this.*

I'll repeat the question asked by others here: why do you need (or think you need) 25 decimal digits.

Here is a cognate quotation from Trefethen:

6. *If the answer is highly sensitive to perturbations, you have probably asked the wrong question.*

These quotations (maxims) can be found at:

http://people.maths.ox.ac.uk/trefethen/maxims.html

This Matlab Newsgroup thread may be useful:

http://www.mathworks.com/matlabcentral/newsreader/view_thread/300051

Jan Simon
on 26 Jun 2011

I see a contradiction between the two statements: Imagine that you want to find out, if an answer is highly sensitive to perturbations of a value, which is known to 11 digits. Therefore you need _some_ more digits, such that the 64bit doubles are a a quite fine choice.

Derek O'Connor
on 28 Jun 2011

Jan,

I don't understand why you need more digits. Why not change the last digit of the 11-digit value and see if there is a large change in the answer?

I do not see a contradiction between Maxim 6 and Maxim 11. They are essentially "orthogonal", i.e., independent. Of course, if a problem is ill-conditioned then many digits may be needed to get an exact answer, which seems to contradict maxim 11. But Maxim 6 says that you should not be solving ill-conditioned problems (except as a hobby, maybe).

See the thread in my answer above and pages 8 to 11 in

http://www.scribd.com/doc/26135665/Two-Simple-Statistical-Calculations-and-ClimateGate

Related Content

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
## 3 Comments

## Jan Simon (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/10033#comment_21996

Satellite data with an accuracy of 25 digits? You need such an accuracy to determine the earth-sun distance with less than a radius of a neutron.

I'm very interested in the scientific application of such an accuracy.

## Matt Fig (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/10033#comment_22002

Dias, I too doubt the actual accuracy of that many digits. There is a difference between having 25 digits and having 25 useful digits.

MATLAB always uses doubles unless you specify another data type. The display (format long g) has nothing to do with the internal storage. The number is the same no matter how it is displayed in the command window...

## the cyclist (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/10033#comment_22037

It could be that the each number being sent encode information on more than one variable, with some kind of multiplexing. So, maybe the final digits are not just more precision on the first digits.