Re: Graphing Difference Equation
- To: mathgroup at smc.vnet.net
- Subject: [mg91407] Re: Graphing Difference Equation
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 20 Aug 2008 06:22:39 -0400 (EDT)
- Organization: Uni Leipzig
- References: <g8gj3h$eso$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi,
a) you have serious problems with the Mathematica syntax
the equation
y_{t} = 1.5y_{t-1} - .5y_{t-2} = 0
is total nonsense because you have either
y[t] == 3*y[t - 1]/2 - y[t - 2]/2
or
3*y[t - 1]/2 - y[t - 2]/2==0
or y[t]==0
b) If you have a discrete equation you must plot
discrete values and not a continuous function,
i.e.
sol = y[t] /. RSolve[y[t] == 3*y[t - 1]/2 - y[t - 2]/2, y[t], t][[1]];
ListPlot[Table[Evaluate[sol /. {C[1] -> 1 , C[2] -> 0}], {t, 0, 10}]]
Regards
Jens
Walkman 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.
>