Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

RE: help for time series basic operations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46061] RE: [mg46046] help for time series basic operations
  • From: "John C. Erb, Ph.D." <John_C_Erb at prodigy.net>
  • Date: Wed, 4 Feb 2004 02:29:31 -0500 (EST)
  • Reply-to: <John_C_Erb at prodigy.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I'm sure there are more "elegant" ways, but
a Do loop works fine

Example

this={a1,a2,a3,a4,a5};
that=Table[0,{i,Length[this]-1}];
Do[
    that[[i]]=this[[2]]-this[[1]];
    this=Drop[this,1];,
{i,Length[that]}];
that

John C. Erb
Email:  John_C_Erb at prodigy.net

-----Original Message-----
From: paolo [mailto:tarpanelli at libero.it] 
To: mathgroup at smc.vnet.net
Subject: [mg46061] [mg46046] help for time series basic operations

I am a quantitative analyst and for the first time i am using
Mathematica. So, I
am sorry if my question seem "very easy (almost stupid)" but i need some
helps
to begin to understand Mathematica

I have a time series 
a:=[a_1,a_2,a_3,a_4,...a_n]
how can i do to subtract each element for the previous one?:

b:=[a_2 - a_1, a_3 - a_2, a_4 - a_3,.....,a_n - a_n-1]

Thanks

Paolo Tarpanelli



  • Prev by Date: Re: help for time series basic operations
  • Next by Date: Re: How do I Copy an error message to a text document, as text?
  • Previous by thread: Re: help for time series basic operations
  • Next by thread: Re: help for time series basic operations