Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: precision of numbers?

Subject: precision of numbers?

From: dbsearch04@yahoo.com

Date: 04 Jul, 2007 16:45:20

Message: 1 of 4

Hello Matlab UG:

I ran the following simple script under V2007a:

>> A = [0,1;1,1]

>> A^1000

>> A^10000

The first computation gives 4 numbers (time e+208) as expected.

The second computation gives 4 values of 'Inf'!?!

Is it possible to tell Matlab to use greater precision for its
computations?

TIA.

Regards..

Subject: Re: precision of numbers?

From: John D'Errico

Date: 04 Jul, 2007 20:08:29

Message: 2 of 4

dbsearch04 wrote:
>
>
> Hello Matlab UG:
>
> I ran the following simple script under V2007a:
>
>>> A = [0,1;1,1]
>
>>> A^1000
>
>>> A^10000
>
> The first computation gives 4 numbers (time e+208) as expected.
>
> The second computation gives 4 values of 'Inf'!?!
>
> Is it possible to tell Matlab to use greater precision for its
> computations?
>
> TIA.
>
> Regards..

(This is not a precision question.)

Could you do this, then someone else
would be asking why they cannot compute

  A^10000000000000

or some arbitrarily higher power.

If you truly need this, there is
always the symbolic toolbox, using
vpa.

John

Subject: Re: precision of numbers?

From: dbsearch04@yahoo.com

Date: 09 Jul, 2007 20:33:57

Message: 3 of 4

Hello John:

Thanks for answering this question. I did not think that this was a
frivolous question. It is part of a Fibonacci speed computation
programming problem.

Since I am new to Matlab, I had no idea what vpa was/is. Subsequently,
I did find an example using vpa. In case anyone else needs this, here
is the code to do what I asked:

>> A=[0,1;1,1]
>> vA = vpa(A,30)
>> vA^10000

ans =

[ .20793608237133498072112648988638e2090, .
33644764876431783266621612005100e2090]
[ .33644764876431783266621612005100e2090, .
54438373113565281338734260993738e2090]

Finally, it must be related to precision, since the "fix" is to use
variable precision arithmetic.

Thanks again.

Regards..
--------------------------------------------------------------------------------------------
On Jul 4, 5:08 pm, "John D'Errico" <woodch...@rochester.rr.com> wrote:
>
> (This is not a precision question.)
>
> Could you do this, then someone else
> would be asking why they cannot compute
>
> A^10000000000000
>
> or some arbitrarily higher power.
>
> If you truly need this, there is
> always the symbolic toolbox, using
> vpa.
>
> John- Hide quoted text -
>
> - Show quoted text -


Subject: Re: precision of numbers?

From: carlos lopez

Date: 09 Aug, 2007 20:21:50

Message: 4 of 4

> Is it possible to tell Matlab to use greater precision for its
> computations?
What you need is an expanded _range_ for the representable
numbers, and not _greater precision_. The latter is related
with the machine epsilon (which in turn is related with the
number of bits of the mantissa) while the former is related
to the maximum/minimum expontent
Check the FEX for the Multiple Precision toolbox by Ben
Barrowes; it might be helpful.
Regards
Carlos

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics