Re: Need Help
- To: mathgroup at smc.vnet.net
- Subject: [mg94688] Re: Need Help
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sat, 20 Dec 2008 06:21:56 -0500 (EST)
On 12/19/08 at 7:22 AM, koyedeji at morehouse.edu (Oyedeji, Kale) wrote: >Bill, thanks for your comment. I have two iterative implicit >functions S[k] and R[k] for which I plotted these functions versus >k. But now wants to see the effect of including a random function in >the expression for S[k]. Daniel made suggestion that seem to work >except that I was getting some error message from his suggestion >shown below. The error message is Do::itform: Argument R[k+1]=f S[k] >R[k] at position 2 does not have the correct form for an iterator. >>>. Will someone please help out. I spent hours in the Help pages of >Mathematica, ver 6 without success. I am afraid to load ver 7 as of >now. >'Kale >B = 8.; >f = 3. 10^-5; >n = 10; >S[0] = 3400; >R[0] = 9; >Do[ >S[k + 1] = R[k]*B Random[] - f*S[k]*R[k]; >R[k + 1] = f*S[k]*R[k]; >, {k, 0, 10}] I admit it is still unclear to me what you hope to accomplish here. Your code gives a well defined starting value for the various functions. But all subsequent values are the previous value plus a random offset. Consequently, none of the no value other than the initial value is predicable. The only rule for generating the sequence of values is your code. And in fact (since you don't specifically initialize Mathematica's internal random number generator to a specific state), repeated usage of your code will generate different sequences. The entire purpose of RSolve is to find a general rule for a sequence that is more compact than writing out the sequence itself. But your code prohibits such a rule from existing. That is, usage of RSolve is fundamentally incompatible with a sequence of pseudo random numbers. Note, this is not to say RSolve cannot find a rule for whatever finite length sample of the sequence you feed it. One can always find a formula for any arbitrary finite list of numbers. If nothing else, a sequence of n+1 values uniquely defines a polynomial of degree n. But what is the point of this. You may as well generate a nth degree polynomial by doing something like Table[RandomReal[] x^n, {n, 0, k}]