MathGroup Archive 2006

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

Search the Archive

a[[0]] equivalent to a[[-1]] and so forth

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65120] a[[0]] equivalent to a[[-1]] and so forth
  • From: "Alexandre Costa" <amscosta at uem.br>
  • Date: Wed, 15 Mar 2006 06:28:37 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Dear Group,
I have a simple issue:
If  I have a list such as :
a = {4, 5, 6};
How can I do this in an elegant way:
a[[0]] equivalent to a[[-1]]
a[[-1]] equivalent to a[[-2]]
and so forth.

I thought of a[[If[i <=0, i - 1, i]]] would solve the problem
but I want a more elegant way of doing this.

Any help is very welcome,
Thanks,
Alex



  • Prev by Date: Re: speed of evaluation of an instruction
  • Next by Date: Multiple Selections in Notebook
  • Previous by thread: Re: Re: Fourier expansion of (Cos[t]+A Cos[3 t])^1/3
  • Next by thread: Re: a[[0]] equivalent to a[[-1]] and so forth