Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!news.belwue.de!news.uni-stuttgart.de!news.nask.pl!news.nask.org.pl!news.onet.pl!not-for-mail
From: ZikO <zebik@op.pl>
Newsgroups: comp.soft-sys.matlab
Subject: Re: To display big number in all digits form.
Date: Thu, 19 Mar 2009 14:02:47 +0000
Organization: http://onet.pl
Lines: 63
Message-ID: <gptja9$hml$1@news.onet.pl>
References: <gps84r$1e2$1@news.onet.pl>
NNTP-Posting-Host: cpc3-stkp4-0-0-cust389.manc.cable.ntl.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.onet.pl 1237471369 18133 82.17.73.134 (19 Mar 2009 14:02:49 GMT)
X-Complaints-To: niusy@onet.pl
NNTP-Posting-Date: Thu, 19 Mar 2009 14:02:49 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.21 (Windows/20090302)
In-Reply-To: <gps84r$1e2$1@news.onet.pl>
Xref: news.mathworks.com comp.soft-sys.matlab:526127


ZikO wrote:
> Hi
> 
> I am afraid I have very unusual problem. I need to show a very very big 
> number, a Fibonacci(n) series when when n = 1476. It is number of 
> 1.3e308 range. I would like to see this number with all digits. Is it 
> somehow possible in MATLAB.
> 
> Thanks you.

I am not sure if I did it correctly. There is a code which calculates 
Fibonacci series. I used Symbolic Math Toolbox. When i run these 
commands below:

A = sym(fib(1476));
vpa(A,1000);

I got the number:
130698922376339873754511593703999304853661815941920982715896371280424691495866567130509827216117625177952738381240755518030797439683443697785696230802473309617042775347304891963181519627287463521203531259388682404883801028462229399345567884825464934136563115441584430300333788777345438315116223032518554681344

On one of the other groups someone has provided different result:
130698922376339931803631155380271983098392443907412640726006659460192793070479231740288681087777017721095463154979012276234322246936939647185366706368489362660844147449941348462800922755818969634743348982916424954062744135969865615407276492410653721774590669544801490837649161732095972658064630033793347171632

which one is correct and how to check it?

Thanks


% code
function out = fib(n)

N = length(n);
if N == 1
     tab = [1;1;2];
     if n<3
         out = 1;
     else
         n = n - 3;
         for indx = 0:n
             tab(1) = tab(2);
             tab(2) = tab(3);
             tab(3) = tab(1) + tab(2);
         end
         out = tab(2);
     end
else
     out = zeros(N,1);
     for indx_i = 1:N
         tab = [1;1;2];
         if n(indx_i)<3
             out(indx_i) = 1;
         else
             for indx_j = 0:(n(indx_i)-3)
                 tab(1) = tab(2);
                 tab(2) = tab(3);
                 tab(3) = tab(1) + tab(2);
             end
             out(indx_i) = tab(3);
         end
     end
end
% end of code