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
