MathGroup Archive 2003

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

Search the Archive

Re: Plot a recurrence relation

Here's one way:

             NestList[{#1[[1]] + 1, #1[[2]]/(2*#1[[1]] - 1)} & , {0, 6},
           PlotRange -> All, PlotJoined -> True]

If that's too cryptic, define a function to do a step of your iteration, on
the pair {n,a}


This calculates 20 iterations from your starting point


and this plots the results with some appropriate options

ListPlot[iters,PlotRange->All,Prolog -> PointSize[0.03]]

Of course there are 101 other ways, but this is an example of Mathematica's
functional programming style, avoiding loops. The first version also avoids
the need to define any function or variable names.

John Jowett

"David" <davidol at> wrote in message
news:b5mj14$rsa$1 at
> How can I get mathematica to plot a sequence that's defined recursively
> a_0 = 6
> a_(n+1) = a_n / (2n - 7)
> Cheers.

  • Prev by Date: Memory Use growth
  • Next by Date: Re: Strange behavior of Simplify
  • Previous by thread: RE: Plot a recurrence relation
  • Next by thread: Re: Plot a recurrence relation