Re: Unexpected Characters Appearing in Results
- To: mathgroup at smc.vnet.net
- Subject: [mg103291] Re: [mg103263] Unexpected Characters Appearing in Results
- From: Gregory Lypny <gregory.lypny at videotron.ca>
- Date: Sun, 13 Sep 2009 08:02:32 -0400 (EDT)
- References: <200909112357.TAA25403@smc.vnet.net>
Hi Bobby,
Yeh, you're right. Kind of skimped on the details. Sorry about that.
Here's some data, five observations each on the prices of two stocks.
First element in each is stock 1 and the second element is stock 2.
p= {{107, 138}, {119, 129}, {104, 101}, {107, 91}, {123, 94}}
Here's a function for computing standard deviation that goes down each
"column" as it were. I think a version of this was suggested on
MathGroup.
stdDev[x_] := Sqrt[Plus @@ (Plus[#, -Mean@x]^2 & /@ x)/Length@x]
The standard deviation of price is not a problem.
{7.53658, 19.1896}
Now I convert the prices to returns,
(r = Differences@p/Most@p)
{{12/107, -(3/46)}, {-(15/119), -(28/129)}, {3/104, -(10/101)},
{16/107, 3/91}}
leaving me with four observations each because of the differencing.
Taking the standard deviation of returns gives me
{0.105942 \.10, 0.0893377 \.10}
where the \.10 appears when I copy from Mathematica and paste into my
mail software, but in Mathematica, the \.10 appears as an exclamation
mark (!) with what appears to be a skinny space between it and the
last digit reported for each result.
The answers for returns are correct, and the exclamation mark still
appears if I compute r as a numerical approximation rather than
rationals. Any thoughts?
Regards,
Gregory
On 2009-09-12, at 1:47 AM, DrMajorBob wrote:
> Details, Gregory. Details.
>
> Bobby
>
> On Fri, 11 Sep 2009 18:57:30 -0500, Gregory Lypny <gregory.lypny at videotron.ca
> > wrote:
>
>> Hello everyone,
>>
>> I created a function to compute standard deviation, and in some
>> instances it returns a result with an exclamation mark (!) at the
>> end,
>> as in
>>
>> 0.143855 !
>>
>> When the result is copied as plain text and pasted elsewhere, it
>> comes
>> out as
>>
>> 0.143855 \.10
>>
>> Any reason why this is happening? I recently upgraded my Mac to Snow
>> Leopard, and thought that might be the cause.
>>
>> Regards,
>>
>> Gregory
>>
>
>
> --
> DrMajorBob at yahoo.com
- References:
- Unexpected Characters Appearing in Results
- From: Gregory Lypny <gregory.lypny@videotron.ca>
- Unexpected Characters Appearing in Results