Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
precision of numbers?

Subject: precision of numbers?

From: dbsearch04@yahoo.com

Date: 4 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: precision of numbers?

From: John D'Errico

Date: 4 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: precision of numbers?

From: dbsearch04@yahoo.com

Date: 9 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: precision of numbers?

From: carlos lopez

Date: 9 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

No tags are associated with this thread.

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.

Contact us