Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: computation precision and display
Replies: 3   Last Post: Dec 4, 2012 12:32 PM

 Messages: [ Previous | Next ]
 Nasser Abbasi Posts: 6,677 Registered: 2/7/05
Re: computation precision and display
Posted: Dec 3, 2012 9:15 PM

On 12/3/2012 7:01 PM, Jose wrote:
> Hi,
>
> It just happens in my linux 64 bits PC, running Matlab 2010a (on format long g) that when I calculate
>

>>> A=(0.714844838298060 + 0.699283102297360i)*conj(0.714844838298060 + 0.699283102297360i)
>
> A =
>
> 1.000000000000000
>
> Now when I calculate
>
>

>>> B=(0.757342604591773 + 0.653017748051421i)*conj(0.757342604591773 + 0.653017748051421i)
>
> B =
>
> 1
>
> And the difference is:
>

>>> A-B
>
> ans =
>
> -1.11022302462516e-16
>
> This is important because when I try to plot A and B as elements of a
>matrix with a colormap using imagesc they get very different colors.

that is strange, since (A-B) is less than eps

---------------------------------
EDU>> (abs(A-B))<eps('double')

ans =

1
---------------------------------

So, I would have expected same 'color' to show for these.

>
> Then my questions are:
>
> How to interpret a number such as A=1.000000000000000?
>
> Is it possible to display its nonzero decimals after the 15th zero?
>

may be (file exchange command)

-------------------------------
EDU>> num2strexact(A)

ans =

0.99999999999999966693309261245303787291049957275390625
-----------------------------------

Date Subject Author
12/3/12 Jose
12/3/12 Nasser Abbasi
12/4/12 Steven Lord
12/3/12 Roger Stafford