MathGroup Archive 2011

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

Search the Archive

Re: Quick Mathematica Question


Some suggestions:

generations = 5;

Map[Flatten, 
Partition[
NestList[ReplaceAll[#, {0 -> 1, 1 -> {1, 0}}] &, 0, generations - 1], 
1]] // TableForm

Map[ToExpression, 
Map[StringJoin, 
Partition[
NestList[ReplaceAll[#, {"0" -> "1", "1" -> {"1", "0"}}] &, "0", 
generations - 1], 1]]] // TableForm



----- Original Message ----- 
From: "Dean" <deanrosenthal at gmail.com>
Newsgroups: comp.soft-sys.math.mathematica
Sent: Wednesday, January 05, 2011 10:46 AM
Subject: [mg115281] Re: Quick Mathematica Question


> How would I program user-defined rules such as
> 
> 0->1
> 1->10
> 
> to give the output, and specify the number of recursions.  For example,
> starting with 0,
> 
> 0
> 1
> 10
> 101
> 10110
> ...
> 
> Specified, 5 generations.
> 
> -- 
> Dean Rosenthal
> 
> cell: 646 733 6966
> www.deanrosenthal.org
> http://www.the-open-space.org/webmag/test1.html



  • Prev by Date: Re: Solving 2nd order PDE into Mathematica
  • Next by Date: Re: Quick Mathematica Question
  • Previous by thread: Re: Quick Mathematica Question
  • Next by thread: Re: Quick Mathematica Question