Re: Graphing Difference Equation
- To: mathgroup at smc.vnet.net
- Subject: [mg91426] Re: [mg91393] Graphing Difference Equation
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Thu, 21 Aug 2008 04:15:53 -0400 (EDT)
- Reply-to: hanlonr at cox.net
For difference equations use RSolve In[1]:= Clear[y]; In[2]:= y[t_] = y[t] /. RSolve[{ y[t] == (3*y[t - 1] - y[t - 2])/2, y[0] == 0, y[1] == 1}, y[t], t][[1]] // Simplify Out[2]= 2 - 2^(1 - t) In[3]:= {y[0], y[1]} Out[3]= {0,1} In[4]:= Plot[y[t], {t, 0, 20}, PlotRange -> All] Bob Hanlon ---- Walkman <uvnarae at hotmail.com> wrote: ============= Dear Group. I have a trouble in graphing differece equation using mathematica. For instance, I get a difference equation, y_{t} = 1.5y_{t-1} - .5y_{t-2} = 0 Since I don't know how to input the code for graphics and just want to check how the graph looks like, I input the solution instead, A(-1.2)^t + B(.5)^t where A and B constants For simplicity, I choose A = B = 1. Plot[(-1.2)^t + (.5)^t,{t,0,20}] The problem is that it doesn't work at all. If anyone who know exact way to graph difference equation, plz tell me. Thanks in advance.