# Combine Time Series

TimeSeriesThread can be used to add, multiply, or otherwise combine time series.

Subtract two time series.

 In:= X{buseyOpen, buseyClose} = Table[TimeSeries[ FinancialData["NASDAQ:BUSE", prop, {{2013, 6, 1}, {2014, 6, 1}}]], {prop, {"Open", "Close"}}];
 In:= Xdiff = TimeSeriesThread[{1, -1}.# &, {buseyClose, buseyOpen}]
 Out= Out= Construct the time series of angular distance between the Moon and the Sun.

 In:= Xdates = DateRange[{2014, 4, 1}, {2014, 6, 1}, {12, "Hour"}]; sunpos = SunPosition[dates, CelestialSystem -> "Equatorial"]; moonpos = MoonPosition[dates, CelestialSystem -> "Equatorial"];

Define a function to compute the angular distance between two objects on a sphere.

 In:= XAngularDistance[{{\[Phi]1_, \[Theta]1_}, {\[Phi]2_, \[Theta]2_}}] := InverseHaversine[ Haversine[\[Phi]1 - \[Phi]2] + Cos[\[Phi]1] Cos[\[Phi]2] Haversine[\[Theta]1 - \[Theta]2]]/Degree
 In:= Xangdist = TimeSeriesThread[AngularDistance, {sunpos, moonpos}];
 In:= XDateListPlot[angdist, ImageSize -> 300, FrameLabel -> "degrees"]
 Out= ## Mathematica

Questions? Comments? Contact a Wolfram expert »