MathGroup Archive 2009

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

Search the Archive

Re: Unexpected Characters Appearing in Results

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103293] Re: [mg103263] Unexpected Characters Appearing in Results
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Sun, 13 Sep 2009 08:02:56 -0400 (EDT)
  • References: <200909112357.TAA25403@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

Here's what I get at my machine (64-bit Mac OS X, Mathematica 7.0):

p = {{107, 138}, {119, 129}, {104, 101}, {107, 91}, {123, 94}};
stdDev[x_] := Sqrt[Plus @@ (Plus[#, -Mean@x]^2 & /@ x)/Length@x]

stdDev@p // N

{7.53658, 19.1896}

r = Differences@p/Most@p

{{12/107, -(3/46)}, {-(15/119), -(28/129)}, {3/104, -(10/101)}, {16/
   107, 3/91}}

stdDev@r // N

{0.105942, 0.0893377}

I don't know why you're getting those "/.10" artifacts, but I don't know  
if that's exactly what you did, either.

Bobby

On Sat, 12 Sep 2009 15:30:13 -0500, Gregory Lypny  
<gregory.lypny at videotron.ca> wrote:

> 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
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: Unexpected Characters Appearing in Results
  • Next by Date: Re: Unexpected Characters Appearing in Results
  • Previous by thread: Re: Unexpected Characters Appearing in Results
  • Next by thread: Re: Unexpected Characters Appearing in Results