Thank you John, that's helpful,
I have a couple of other questions: firstly, if we have ^&2, ^&0.5, 2&*
and 0.5&*, why do we need *:, %:, +: and -: anyway?
Secondly, we have two types of expressions, J sentences and tacit
programming. If we allow tacit programming in J sentences, why didn't we
originally allow J sentences in tacit programming?
Don
----- Original Message -----
From: "John Randall" <[email protected]>
To: "General forum" <[email protected]>
Sent: Friday, March 13, 2009 1:56 PM
Subject: Re: [Jgeneral] J with APL
> Don Watson wrote:
>> Could someone tell me how I put down a one line J expression that
>> calculates the standard deviation of its right argument - assumed for the
>> moment to be a vector - without naming the argument in the expression.
>
> Calculating it using the textbook definition:
>
> sd=:[: %: +/@:*:@:(- +/ % #) % <:@#
>
> This uses deviates about the mean. It is less numerically stable than
>
> ssq=:+/@:*:
> sqs=:*:@:(+/)
> sd2=:[: %: ((#*ssq)-sqs)% #*<:@#
>
> which uses the sum of squares and the square of the sum. It is broken out
> here to show these operations, but can obviously be put on one line.
>
> Best wishes,
>
> John
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm