Re: LinearRecurrence syntax

*To*: mathgroup at smc.vnet.net*Subject*: [mg115957] Re: LinearRecurrence syntax*From*: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>*Date*: Thu, 27 Jan 2011 03:41:27 -0500 (EST)*References*: <ihoro9$hlh$1@smc.vnet.net>

Actually, the syntax you are using is not documented in the doc page's syntax box (same is true for Ordering). The documentation only mentions n and {nmin,nmax} as possible arguments. It seems it uses n or {1,n} if you enter {n}. I agree that using the {n,n} interpretation instead would be more logical. It's not pretty, but working around it is not a big deal. Cheers -- Sjoerd On Jan 26, 11:07 am, "Mr. Wizard" <gl... at flashmail.com> wrote: > It seems to me that the syntax for LinearRecurrence is not in > agreement with other Mathematica functions. > > In:= LinearRecurrence[{1, 1}, {1, 1}, {10}] > Out= {1, 1, 2, 3, 5, 8, 13, 21, 34, 55} > > I expected 55 or {55}. One must enter 10 twice: > > In:= LinearRecurrence[{1, 1}, {1, 1}, {10,10}] > Out= {55} > > Contrast this with: > > Take[Range@5, {3}] > > Ordering[Range@10, {5}] > > StringTake["abcdefg", {3}] > > IntegerPartitions[5, {3}] > > Subsets[Range@4, {3}] > > Permutations[Range@3, {2}] > > In none of these cases must one enter the index twice. > > Further, the functions that take a Levelspec, read {x} as the > specific level x, not one through x. Again, one does not have to enter= {x, x}. > > a = Array[Plus, {4, 5}]; > > Total[a, {2}] > > Map[EvenQ, a, {2}] > > Perhaps I am overlooking something obvious, but it seems to me that > the behavior of LinearRecurrence[list, list, {i}] should be changed > from "one through i" to only "i." > > Paul