[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: recursion and fsolve
From: |
Bart Vandewoestyne |
Subject: |
Re: recursion and fsolve |
Date: |
Fri, 17 Sep 2004 03:07:16 -0500 |
User-agent: |
Mutt/1.3.28i |
On Fri, Sep 17, 2004 at 01:39:44AM -0400, John W. Eaton wrote:
>
> Sorry, I might have misunderstood the question earlier. I thought the
> question was about what random number generator was used in Matlab.
This was indeed the question :-)
> In the article I referenced, Cleve Moler says it is the same as an
> M-file available on the web (the M-file is not the actual code, but it
> is supposed to produce identical results). Even though there is an
> example implementation available on a web site, it is not clear that
> we can base the code in Octave on it. There is no stated copyright or
> license in the file, but that doesn't mean we can use it.
OK. I did some short reading and I guess these are the conclusions
concerning Matlab's random number generator:
On
http://www.mathworks.com/company/newsletters/news_notes/clevescorner/spring01_cleve.html
which is about the algorithm for generating normally distrubuted random
numbers, it is written:
"We described the algorithm that MATLAB uses for uniform distributions
five years ago in this newsletter."
The 'newsletter' is the 'Random thoughts' article which can be found at:
http://www.mathworks.com/company/newsletters/news_notes/pdf/Cleve.pdf
In that document from 1995, Cleve Moler states that the 'current used
random number generator' is a linear congruential generator with
a=7^5, 16807, c=0 and m=2^31-1=2147483647. In the beginning of this
document, he also gives the first value of this generator, which should
be 0.21895918632809.
Since this document is from 1995, i wanted to check if Matlab still uses
this generator, and apparently in R13 they don't:
>> version
ans =
6.5.0.180913a (R13)
>> rand
ans =
9.501292851471754e-01
In the same 'Random thoughts' column on the second page, Moler describes
the 'new' rand generator 'to be implemented in future versions' of
Matlab. He writes:
"The new algorithm is based on advice from George Marsaglia, a professor
at Florida State University, and author of the classic analysis of
random number generators, "Random numbers fall mainly in the planes,"
(Proc. Nat. Acad. Sci., vol 61, 1968)"
More information on how it works can be found in the same column.
Now in the article address@hidden Cleve Moler tells
us that there is an M-file http://www.mathworks.com/moler/ncm/randtx.m
which exactly produces the same random numbers as the built-in
algorithm. He also mentions `Marsaglia's "Fibonacci subtract with
borrow" generator'...
So my guess would be that the current built-in implementation of the
Matlab rand function is described in the 'Random thoughts' column, and
that http://www.mathworks.com/moler/ncm/randtx.m gives an example
implementation of how it works.
Could i be right on this?
Regards,
Bart
PS: is http://www.octave.org down? Since yesterday, i get time-outs
when i try to access it...
--
!!!!!!!!!!!!!!!!!!! email change !!!!!!!!!!!!!!!!!!!!!!!
My email address is now Bart.Vandewoestyne AT telenet.be
Please update your addressbook!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------