08.02.2015 Views

Sage Reference Manual: Quantitative Finance - Mirrors

Sage Reference Manual: Quantitative Finance - Mirrors

Sage Reference Manual: Quantitative Finance - Mirrors

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Quantitative</strong> <strong>Finance</strong>, Release 6.1.1<br />

A double.<br />

EXAMPLES:<br />

sage: v = finance.TimeSeries([1,1,1,2,3]); v<br />

[1.0000, 1.0000, 1.0000, 2.0000, 3.0000]<br />

sage: v.sum()<br />

8.0<br />

sums(s=0)<br />

Return the new time series got by taking the running partial sums of the terms of this time series.<br />

INPUT:<br />

•s – starting value for partial sums.<br />

OUTPUT:<br />

A time series.<br />

EXAMPLES:<br />

sage: v = finance.TimeSeries([1,1,1,2,3]); v<br />

[1.0000, 1.0000, 1.0000, 2.0000, 3.0000]<br />

sage: v.sums()<br />

[1.0000, 2.0000, 3.0000, 5.0000, 8.0000]<br />

variance(bias=False)<br />

Return the variance of the elements of self, which is the mean of the squares of the differences from the<br />

mean.<br />

INPUT:<br />

•bias – bool (default: False); if False, divide by self.length() - 1 instead of<br />

self.length() to give a less biased estimator for the variance.<br />

OUTPUT:<br />

A double.<br />

EXAMPLE:<br />

sage: v = finance.TimeSeries([1,1,1,2,3]); v<br />

[1.0000, 1.0000, 1.0000, 2.0000, 3.0000]<br />

sage: v.variance()<br />

0.8<br />

sage: v.variance(bias=True)<br />

0.64<br />

TESTS:<br />

sage: finance.TimeSeries([1]).variance()<br />

0.0<br />

sage: finance.TimeSeries([]).variance()<br />

0.0<br />

vector()<br />

Return real double vector whose entries are the values of this time series. This is useful since vectors have<br />

standard algebraic structure and play well with matrices.<br />

OUTPUT:<br />

A real double vector.<br />

EXAMPLES:<br />

19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!