MathGroup Archive 2011

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

Search the Archive

LinearRecurrence syntax

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115939] LinearRecurrence syntax
  • From: "Mr. Wizard" <gleam at flashmail.com>
  • Date: Wed, 26 Jan 2011 05:07:14 -0500 (EST)

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




  • Prev by Date: Re: Fast matrices comparison
  • Next by Date: Re: Fast matrices comparison
  • Previous by thread: Re: Help with While Loop Function
  • Next by thread: Re: LinearRecurrence syntax