MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Need Help

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94625] Re: Need Help
  • From: dh <dh at metrohm.com>
  • Date: Thu, 18 Dec 2008 07:20:12 -0500 (EST)
  • References: <gi7lmj$d1m$1@smc.vnet.net> <200812161106.GAA16849@smc.vnet.net> <giao1f$8l6$1@smc.vnet.net>


Hi,

you have a recusrion formula. To get some values for S and R, you do not 

need to calculate a close form formula. Simply use the recursion: E.g. 

for k=0..11:



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}]

hope this helps, Daniel



Oyedeji, Kale wrote:

> Thannks Daniel for your advice. I changed Evaluate to RSolve but still got the same result. What I wanted was a calculation of S[k] and R[k] for every k. I wanted a random number generated for each k. I expect S[1]= some number, R[1]= some number for each k.

> 

> Thanks also for calling my attention to CopyAs.Plain Text.

> 

> 'Kale

> 

> With[{B=8,f=3x10^-5}, sol=RSolve[{S[k+1]==R[k]*B*Table[Random[],{10000}]-f*S[k]*R[k],R[k+1]==f*S[k]*R[k], S[0]==3400, R[0]==9}, {S,R}, {k,0,10000}]]

> 

> Sample output:

> 

> RSolve[{S[1+k]=={0.561545 R[k]-(3 R[k] S[k])/x10^5,1.80044 R[k]-(3 R[k] S[k])/x10^5,0.901316 R[k]-(3 R[k] S[k])/x10^5,5.51532 R[k]-(3 R[k] S[k])/x10^5,4.2516 R[k]-(3 R[k] S[k])/x10^5,0.949978 R[k]-(3 R[k] S[k])/x10^5,4.13191 R[k]-(3 R[k] S[k])/x10^5,<<9987>>,1.24536 R[k]-(3 R[k] S[k])/x10^5,5.14664 R[k]-(3 R[k] S[k])/x10^5,6.00884 R[k]-(3 R[k] S[k])/x10^5,2.25255 R[k]-(3 R[k] S[k])/x10^5,2.92772 R[k]-(3 R[k] S[k])/x10^5,0.111999 R[k]-(3 R[k] S[k])/x10^5},R[1+k]==(3 R[k] S[k])/x10^5,S[0]==3400,R[0]==9},{S,R},{k,0,10000}]

> 

> 

> -----Original Message-----

> 

> From: dh [mailto:dh at metrohm.com] 

> Sent: Tuesday, December 16, 2008 6:06 AM

> Subject:  Re: Need Help

> 

> Hi,

> 

> if you paste output into a mail, you should use CopyAs.Plain Text from 

> the Edit menu. I tried to fix your expression:

> 

> With[{B=8,f=3 

> 

> 10-5},sol=Evaluate[{S[k+1]==R[k]*B*Table[Random[],{10000}]-f*S[k]*R[k],R[k+1]= 

> 

> =f*S[k]*R[k], S[0]==3400, R[0]==9}, {S,R}, {k,0,10000}]]

> 

> Please read in the manual about Evaluate, it is not what you want. Look 

> at RSolve instead.

> 

> Further, you have a recursion formula that contains random numbers???? 

> 

> In addition, instead of a random number you have a vector of random 

> numbers??

> 

> What are you trying to do???

> 

> Daniel

> 




  • Prev by Date: Re: NIntegrate Problem
  • Next by Date: Re: Mathematica 7 weirdness
  • Previous by thread: Re: Re: Need Help
  • Next by thread: Re: Re: Need Help